本文整理汇总了C++中IServerSPtr::driver方法的典型用法代码示例。如果您正苦于以下问题:C++ IServerSPtr::driver方法的具体用法?C++ IServerSPtr::driver怎么用?C++ IServerSPtr::driver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServerSPtr
的用法示例。
在下文中一共展示了IServerSPtr::driver方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: clear
void ServersManager::clear()
{
for(size_t i = 0; i < servers_.size(); ++i){
IServerSPtr ser = servers_[i];
ser->driver()->stop();
}
servers_.clear();
}
示例3: 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());
}
}
}
}
}
}
示例4:
std::vector<QObject *> ServersManager::findAllListeners(const IDriverSPtr &drv) const
{
std::vector<QObject *> result;
for(size_t j = 0; j < servers_.size(); ++j){
IServerSPtr ser = servers_[j];
if(ser->driver() == drv){
result.push_back(ser.get());
}
}
return result;
}
示例5: findServerBySetting
IServerSPtr ServersManager::findServerBySetting(const IConnectionSettingsBaseSPtr &settings) const
{
for(size_t i = 0; i < servers_.size(); ++i){
IServerSPtr drp = servers_[i];
IDriverSPtr curDr = drp->driver();
if(curDr->settings() == settings){
return drp;
}
}
return IServerSPtr();
}
示例6: closeServer
void ServersManager::closeServer(IServerSPtr server)
{
for(size_t i = 0; i < servers_.size(); ++i){
IServerSPtr ser = servers_[i];
if(ser == server){
if(ser->isSuperServer()){
IDriverSPtr drv = ser->driver();
for(size_t j = 0; j < servers_.size(); ++j){
IServerSPtr servj = servers_[j];
if(servj->driver() == drv){
servj->isSuperServer_ = true;
break;
}
}
}
servers_.erase(servers_.begin()+i);
refreshSyncServers();
break;
}
}
}