本文整理汇总了C++中boost::optional::getSyncSourceIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ optional::getSyncSourceIndex方法的具体用法?C++ optional::getSyncSourceIndex怎么用?C++ optional::getSyncSourceIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::optional
的用法示例。
在下文中一共展示了optional::getSyncSourceIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shouldStopFetching
bool DataReplicatorExternalStateMock::shouldStopFetching(
const HostAndPort& source,
const rpc::ReplSetMetadata& replMetadata,
boost::optional<rpc::OplogQueryMetadata> oqMetadata) {
lastSyncSourceChecked = source;
// If OplogQueryMetadata was provided, use its values, otherwise use the ones in
// ReplSetMetadata.
if (oqMetadata) {
syncSourceLastOpTime = oqMetadata->getLastOpApplied();
syncSourceHasSyncSource = oqMetadata->getSyncSourceIndex() != -1;
} else {
syncSourceLastOpTime = replMetadata.getLastOpVisible();
syncSourceHasSyncSource = replMetadata.getSyncSourceIndex() != -1;
}
return shouldStopFetchingResult;
}
示例2: shouldStopFetching
bool DataReplicatorExternalStateImpl::shouldStopFetching(
const HostAndPort& source,
const rpc::ReplSetMetadata& replMetadata,
boost::optional<rpc::OplogQueryMetadata> oqMetadata) {
// Re-evaluate quality of sync target.
if (_replicationCoordinator->shouldChangeSyncSource(source, replMetadata, oqMetadata)) {
// If OplogQueryMetadata was provided, its values were used to determine if we should
// change sync sources.
if (oqMetadata) {
log() << "Canceling oplog query due to OplogQueryMetadata. We have to choose a new "
"sync source. Current source: "
<< source << ", OpTime " << oqMetadata->getLastOpApplied()
<< ", its sync source index:" << oqMetadata->getSyncSourceIndex();
} else {
log() << "Canceling oplog query due to ReplSetMetadata. We have to choose a new sync "
"source. Current source: "
<< source << ", OpTime " << replMetadata.getLastOpVisible()
<< ", its sync source index:" << replMetadata.getSyncSourceIndex();
}
return true;
}
return false;
}