本文整理汇总了C++中ShardType::getDraining方法的典型用法代码示例。如果您正苦于以下问题:C++ ShardType::getDraining方法的具体用法?C++ ShardType::getDraining怎么用?C++ ShardType::getDraining使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShardType
的用法示例。
在下文中一共展示了ShardType::getDraining方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _addShard_inlock
void ShardRegistry::_addShard_inlock(const ShardType& shardType) {
// This validation should ideally go inside the ShardType::validate call. However, doing
// it there would prevent us from loading previously faulty shard hosts, which might have
// been stored (i.e., the entire getAllShards call would fail).
auto shardHostStatus = ConnectionString::parse(shardType.getHost());
if (!shardHostStatus.isOK()) {
warning() << "Unable to parse shard host "
<< shardHostStatus.getStatus().toString();
}
const ConnectionString& shardHost(shardHostStatus.getValue());
shared_ptr<Shard> shard = boost::make_shared<Shard>(shardType.getName(),
shardHost,
shardType.getMaxSize(),
shardType.getDraining());
_lookup[shardType.getName()] = shard;
_lookup[shardType.getHost()] = shard;
if (shardHost.type() == ConnectionString::SET) {
if (shardHost.getSetName().size()) {
_rsLookup[shardHost.getSetName()] = shard;
}
vector<HostAndPort> servers = shardHost.getServers();
for (unsigned i = 0; i < servers.size(); i++) {
_lookup[servers[i].toString()] = shard;
}
}
}