当前位置: 首页>>代码示例>>C++>>正文


C++ MasterCMCommand::useCache方法代码示例

本文整理汇总了C++中MasterCMCommand::useCache方法的典型用法代码示例。如果您正苦于以下问题:C++ MasterCMCommand::useCache方法的具体用法?C++ MasterCMCommand::useCache怎么用?C++ MasterCMCommand::useCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MasterCMCommand的用法示例。


在下文中一共展示了MasterCMCommand::useCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:OlafRocket,项目名称:Collage,代码行数:28,代码来源:objectCM.cpp

示例2: _sendMapReply

void ObjectCM::_sendMapReply( const MasterCMCommand& command,
                              const uint128_t& version, const bool result,
                              const bool useCache, const bool multicast )
{
    command.getNode()->send( CMD_NODE_MAP_OBJECT_REPLY, multicast )
            << command.getNode()->getNodeID() << command.getObjectID()
            << version << command.getRequestID() << result
            << command.useCache() << useCache;
}
开发者ID:rttag,项目名称:Collage,代码行数:9,代码来源:objectCM.cpp

示例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;
}
开发者ID:tribal-tec,项目名称:Collage,代码行数:22,代码来源:fullMasterCM.cpp

示例4: _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 );
}
开发者ID:rttag,项目名称:Collage,代码行数:21,代码来源:objectCM.cpp


注:本文中的MasterCMCommand::useCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。