本文整理汇总了C++中CBHStatus::isOK方法的典型用法代码示例。如果您正苦于以下问题:C++ CBHStatus::isOK方法的具体用法?C++ CBHStatus::isOK怎么用?C++ CBHStatus::isOK使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBHStatus
的用法示例。
在下文中一共展示了CBHStatus::isOK方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
// Initial Sync
Status DatabasesCloner::start() {
_active = true;
if (!_status.isOK() && _status.code() != ErrorCodes::NotYetInitialized) {
return _status;
}
_status = Status::OK();
log() << "starting cloning of all databases";
// Schedule listDatabase command which will kick off the database cloner per result db.
Request listDBsReq(_source,
"admin",
BSON("listDatabases" << true),
rpc::ServerSelectionMetadata(true, boost::none).toBSON());
CBHStatus s = _exec->scheduleRemoteCommand(
listDBsReq,
stdx::bind(&DatabasesCloner::_onListDatabaseFinish, this, stdx::placeholders::_1));
if (!s.isOK()) {
_setStatus(s);
_failed();
}
_doNextActions();
return _status;
}
示例2: _startHeartbeats
void ReplicationCoordinatorImpl::_startHeartbeats() {
ReplicaSetConfig::MemberIterator it = _rsConfig.membersBegin();
ReplicaSetConfig::MemberIterator end = _rsConfig.membersBegin();
for(;it != end; it++) {
HostAndPort host = it->getHostAndPort();
CBHStatus status = _replExecutor->scheduleWork(
stdx::bind(
&ReplicationCoordinatorImpl::doMemberHeartbeat,
this,
stdx::placeholders::_1,
host));
if (!status.isOK()) {
log() << "replset: cannot start heartbeats for "
<< host << " due to scheduling error -- "<< status;
continue;
}
_trackHeartbeatHandle(status.getValue());
}
}
示例3: doMemberHeartbeat
void ReplicationCoordinatorImpl::doMemberHeartbeat(ReplicationExecutor::CallbackData cbData,
const HostAndPort& hap) {
if (cbData.status == ErrorCodes::CallbackCanceled) {
return;
}
// Are we blind, or do we have a failpoint setup to ignore this member?
bool dontHeartbeatMember = false; // TODO: replSetBlind should be here as the default
MONGO_FAIL_POINT_BLOCK(rsHeartbeatRequestNoopByMember, member) {
const StringData& stopMember = member.getData()["member"].valueStringData();
HostAndPort ignoreHAP;
Status status = ignoreHAP.initialize(stopMember);
// Ignore
if (status.isOK()) {
if (hap == ignoreHAP) {
dontHeartbeatMember = true;
}
} else {
log() << "replset: Bad member for rsHeartbeatRequestNoopByMember failpoint "
<< member.getData() << ". 'member' failed to parse into HostAndPort -- "
<< status;
}
}
if (dontHeartbeatMember) {
// Don't issue real heartbeats, just call start again after the timeout.
ReplicationExecutor::CallbackFn restartCB = stdx::bind(
&ReplicationCoordinatorImpl::doMemberHeartbeat,
this,
stdx::placeholders::_1,
hap);
CBHStatus status = _replExecutor->scheduleWorkAt(
Date_t(curTimeMillis64() + heartbeatFrequencyMillis),
restartCB);
if (!status.isOK()) {
log() << "replset: aborting heartbeats for " << hap << " due to scheduling error"
<< " -- "<< status;
return;
}
_trackHeartbeatHandle(status.getValue());
return;
}
// Compose heartbeat command message
BSONObj hbCommandBSON;
{
// take lock to build request
boost::lock_guard<boost::mutex> lock(_mutex);
BSONObjBuilder cmdBuilder;
const MemberConfig me = _rsConfig.getMemberAt(_thisMembersConfigIndex);
cmdBuilder.append("replSetHeartbeat", _rsConfig.getReplSetName());
cmdBuilder.append("v", _rsConfig.getConfigVersion());
cmdBuilder.append("pv", 1);
cmdBuilder.append("checkEmpty", false);
cmdBuilder.append("from", me.getHostAndPort().toString());
cmdBuilder.append("fromId", me.getId());
hbCommandBSON = cmdBuilder.done();
}
const ReplicationExecutor::RemoteCommandRequest request(hap, "admin", hbCommandBSON);
ReplicationExecutor::RemoteCommandCallbackFn callback = stdx::bind(
&ReplicationCoordinatorImpl::_handleHeartbeatResponse,
this,
stdx::placeholders::_1,
hap,
curTimeMillis64(),
heartbeatRetries);
CBHStatus status = _replExecutor->scheduleRemoteCommand(request, callback);
if (!status.isOK()) {
log() << "replset: aborting heartbeats for " << hap << " due to scheduling error"
<< status;
return;
}
_trackHeartbeatHandle(status.getValue());
}