本文整理汇总了C++中ReplSetConfig::getDefaultWriteConcern方法的典型用法代码示例。如果您正苦于以下问题:C++ ReplSetConfig::getDefaultWriteConcern方法的具体用法?C++ ReplSetConfig::getDefaultWriteConcern怎么用?C++ ReplSetConfig::getDefaultWriteConcern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReplSetConfig
的用法示例。
在下文中一共展示了ReplSetConfig::getDefaultWriteConcern方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findSelfInConfig
StatusWith<int> validateConfigForReconfig(ReplicationCoordinatorExternalState* externalState,
const ReplSetConfig& oldConfig,
const ReplSetConfig& newConfig,
ServiceContext* ctx,
bool force) {
Status status = newConfig.validate();
if (!status.isOK()) {
return StatusWith<int>(status);
}
status = newConfig.checkIfWriteConcernCanBeSatisfied(newConfig.getDefaultWriteConcern());
if (!status.isOK()) {
return status.withContext(
"Found invalid default write concern in 'getLastErrorDefaults' field");
}
status = validateOldAndNewConfigsCompatible(oldConfig, newConfig);
if (!status.isOK()) {
return StatusWith<int>(status);
}
status = validateArbiterPriorities(newConfig);
if (!status.isOK()) {
return StatusWith<int>(status);
}
if (force) {
return findSelfInConfig(externalState, newConfig, ctx);
}
return findSelfInConfigIfElectable(externalState, newConfig, ctx);
}
示例2: findSelfInConfigIfElectable
StatusWith<int> validateConfigForInitiate(ReplicationCoordinatorExternalState* externalState,
const ReplSetConfig& newConfig,
ServiceContext* ctx) {
Status status = newConfig.validate();
if (!status.isOK()) {
return StatusWith<int>(status);
}
status = newConfig.checkIfWriteConcernCanBeSatisfied(newConfig.getDefaultWriteConcern());
if (!status.isOK()) {
return status.withContext(
"Found invalid default write concern in 'getLastErrorDefaults' field");
}
status = validateArbiterPriorities(newConfig);
if (!status.isOK()) {
return StatusWith<int>(status);
}
if (newConfig.getConfigVersion() != 1) {
return StatusWith<int>(ErrorCodes::NewReplicaSetConfigurationIncompatible,
str::stream() << "Configuration used to initiate a replica set must "
<< " have version 1, but found "
<< newConfig.getConfigVersion());
}
return findSelfInConfigIfElectable(externalState, newConfig, ctx);
}