本文整理汇总了C++中ReplSetConfig::asBson方法的典型用法代码示例。如果您正苦于以下问题:C++ ReplSetConfig::asBson方法的具体用法?C++ ReplSetConfig::asBson怎么用?C++ ReplSetConfig::asBson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReplSetConfig
的用法示例。
在下文中一共展示了ReplSetConfig::asBson方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: haveNewConfig
void ReplSet::haveNewConfig(ReplSetConfig& newConfig, bool addComment) {
bo comment;
if( addComment )
comment = BSON( "msg" << "Reconfig set" << "version" << newConfig.version );
newConfig.saveConfigLocally(comment);
try {
BSONObj oldConfForAudit = config().asBson();
BSONObj newConfForAudit = newConfig.asBson();
audit::logReplSetReconfig(ClientBasic::getCurrent(),
&oldConfForAudit,
&newConfForAudit);
if (initFromConfig(newConfig, true)) {
log() << "replSet replSetReconfig new config saved locally" << rsLog;
}
}
catch(DBException& e) {
log() << "replSet error unexpected exception in haveNewConfig() : " << e.toString() << rsLog;
_fatal();
}
catch(...) {
log() << "replSet error unexpected exception in haveNewConfig()" << rsLog;
_fatal();
}
}
示例2: haveNewConfig
void ReplSet::haveNewConfig(OperationContext* txn, ReplSetConfig& newConfig, bool addComment) {
bo comment;
if( addComment )
comment = BSON( "msg" << "Reconfig set" << "version" << newConfig.version );
newConfig.saveConfigLocally(txn, comment);
try {
BSONObj oldConfForAudit = config().asBson();
BSONObj newConfForAudit = newConfig.asBson();
audit::logReplSetReconfig(ClientBasic::getCurrent(),
&oldConfForAudit,
&newConfForAudit);
if (initFromConfig(txn, newConfig, true)) {
log() << "replSet replSetReconfig new config saved locally" << rsLog;
}
}
catch (const DBException& e) {
log() << "replSet error unexpected exception in haveNewConfig() : " << e.toString() << rsLog;
fassertFailedNoTrace(18755);
}
catch (...) {
std::terminate();
}
}