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


C++ IServerSPtr::syncWithServer方法代码示例

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


在下文中一共展示了IServerSPtr::syncWithServer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createServer

    IServerSPtr ServersManager::createServer(IConnectionSettingsBaseSPtr settings)
    {
        DCHECK(settings);

        IServerSPtr result;
        connectionTypes conT = settings->connectionType();
        IServerSPtr ser = findServerBySetting(settings);
        if(conT == REDIS){
            RedisServer *newRed = NULL;
            if(!ser){
                IDriverSPtr dr(new RedisDriver(settings));
                dr->start();
                newRed = new RedisServer(dr, true);
            }
            else{
                newRed = new RedisServer(ser->driver(), false);
            }
            result.reset(newRed);
            servers_.push_back(result);
        }
        else if(conT == MEMCACHED){
            MemcachedServer *newMem = NULL;
            if(!ser){
                IDriverSPtr dr(new MemcachedDriver(settings));
                dr->start();
                newMem = new MemcachedServer(dr, true);
            }
            else{
                newMem = new MemcachedServer(ser->driver(), false);
            }
            result.reset(newMem);
            servers_.push_back(result);
        }
        else if(conT == SSDB){
            SsdbServer *newSsdb = NULL;
            if(!ser){
                IDriverSPtr dr(new SsdbDriver(settings));
                dr->start();
                newSsdb = new SsdbServer(dr, true);
            }
            else{
                newSsdb = new SsdbServer(ser->driver(), false);
            }
            result.reset(newSsdb);
            servers_.push_back(result);
        }

        DCHECK(result);
        if(ser && syncServers_){
            result->syncWithServer(ser.get());
        }

        return result;
    }
开发者ID:TakedWind,项目名称:fastoredis,代码行数:54,代码来源:servers_manager.cpp

示例2: refreshSyncServers

 void ServersManager::refreshSyncServers()
 {
     for(size_t i = 0; i < servers_.size(); ++i){
         IServerSPtr servi = servers_[i];
         if(servi->isSuperServer()){
             for(size_t j = 0; j < servers_.size(); ++j){
                 IServerSPtr servj = servers_[j];
                 if(servj != servi && servj->driver() == servi->driver()){
                     if(syncServers_){
                         servj->syncWithServer(servi.get());
                     }
                     else{
                         servj->unSyncFromServer(servi.get());
                     }
                 }
             }
         }
     }
 }
开发者ID:TakedWind,项目名称:fastoredis,代码行数:19,代码来源:servers_manager.cpp

示例3: createServer

    IServerSPtr ServersManager::createServer(IConnectionSettingsBaseSPtr settings)
    {
        DCHECK(settings);

        IServerSPtr result;
        connectionTypes conT = settings->connectionType();
        IServerSPtr ser = findServerBySetting(settings);
#ifdef BUILD_WITH_REDIS
        if(conT == REDIS){
            result.reset(make_server<RedisServer, RedisDriver>(ser, settings));
        }
#endif
#ifdef BUILD_WITH_MEMCACHED
        if(conT == MEMCACHED){
            result.reset(make_server<MemcachedServer, MemcachedDriver>(ser, settings));
        }
#endif
#ifdef BUILD_WITH_SSDB
        if(conT == SSDB){
            result.reset(make_server<SsdbServer, SsdbDriver>(ser, settings));
        }
#endif
#ifdef BUILD_WITH_LEVELDB
        if(conT == LEVELDB){
            result.reset(make_server<LeveldbServer, LeveldbDriver>(ser, settings));
        }
#endif

        DCHECK(result);
        if(result){
            servers_.push_back(result);
            if(ser && syncServers_){
                result->syncWithServer(ser.get());
            }
        }

        return result;
    }
开发者ID:kfuchs,项目名称:fastonosql,代码行数:38,代码来源:servers_manager.cpp


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