本文整理汇总了C++中MasterCMCommand::getMasterInstanceID方法的典型用法代码示例。如果您正苦于以下问题:C++ MasterCMCommand::getMasterInstanceID方法的具体用法?C++ MasterCMCommand::getMasterInstanceID怎么用?C++ MasterCMCommand::getMasterInstanceID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MasterCMCommand
的用法示例。
在下文中一共展示了MasterCMCommand::getMasterInstanceID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendSync
bool ObjectCM::sendSync( const MasterCMCommand& command )
{
lunchbox::ScopedFastWrite mutex( _lock );
if( !_object )
{
LBWARN << "Sync from detached object requested" << std::endl;
return false;
}
const uint128_t& maxCachedVersion = command.getMaxCachedVersion();
const bool useCache =
command.useCache() &&
command.getMasterInstanceID() == _object->getInstanceID() &&
maxCachedVersion == getVersion();
if( !useCache )
{
ObjectInstanceDataOStream os( this );
os.enableSync( getVersion(), command );
_object->getInstanceData( os );
os.disable();
}
NodePtr node = command.getNode();
node->send( CMD_NODE_SYNC_OBJECT_REPLY, useCache /*preferMulticast*/ )
<< node->getNodeID() << command.getObjectID() << command.getRequestID()
<< true << command.useCache() << useCache;
return true;
}
示例2: _addSlave
void ObjectCM::_addSlave( MasterCMCommand command, const uint128_t& version )
{
LBASSERT( version != VERSION_NONE );
LBASSERT( command.getType() == COMMANDTYPE_NODE );
LBASSERT( command.getCommand() == CMD_NODE_MAP_OBJECT );
// process request
if( command.getRequestedVersion() == VERSION_NONE )
{
// no data to send, send empty version
_sendMapSuccess( command, false /* mc */ );
_sendEmptyVersion( command, VERSION_NONE, false /* mc */ );
_sendMapReply( command, VERSION_NONE, true, false, false /* mc */ );
return;
}
const bool replyUseCache = command.useCache() &&
(command.getMasterInstanceID() == _object->getInstanceID( ));
_initSlave( command, version, replyUseCache );
}
示例3: sendSync
bool FullMasterCM::sendSync( const MasterCMCommand& command )
{
//const uint128_t& version = command.getRequestedVersion();
const uint128_t& maxCachedVersion = command.getMaxCachedVersion();
const bool useCache =
command.useCache() &&
command.getMasterInstanceID() == _object->getInstanceID() &&
maxCachedVersion == _version;
if( !useCache )
{
Mutex mutex( _slaves );
InstanceData* instanceData = _instanceDatas.back();
instanceData->os.sync( command );
}
NodePtr node = command.getNode();
node->send( CMD_NODE_SYNC_OBJECT_REPLY, useCache /*preferMulticast*/ )
<< node->getNodeID() << command.getObjectID() << command.getRequestID()
<< true << command.useCache() << useCache;
return true;
}