本文整理汇总了C++中DiskLoc::toRecordId方法的典型用法代码示例。如果您正苦于以下问题:C++ DiskLoc::toRecordId方法的具体用法?C++ DiskLoc::toRecordId怎么用?C++ DiskLoc::toRecordId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiskLoc
的用法示例。
在下文中一共展示了DiskLoc::toRecordId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
RecordId RecordStoreV1RepairIterator::getNext() {
const DiskLoc retVal = _currRecord;
const ExtentManager* em = _recordStore->_extentManager;
while (true) {
if (_currRecord.isNull()) {
if (!_advanceToNextValidExtent()) {
return retVal.toRecordId();
}
_seenInCurrentExtent.clear();
// Otherwise _advanceToNextValidExtent would have returned false
//
invariant(!_currExtent.isNull());
const Extent* e = em->getExtent(_currExtent, false);
_currRecord = (FORWARD_SCAN == _stage ? e->firstRecord : e->lastRecord);
}
else {
switch (_stage) {
case FORWARD_SCAN:
_currRecord = _recordStore->getNextRecordInExtent(_txn, _currRecord);
break;
case BACKWARD_SCAN:
_currRecord = _recordStore->getPrevRecordInExtent(_txn, _currRecord);
break;
default:
invariant(!"This should never be reached.");
break;
}
}
if (_currRecord.isNull()) {
continue;
}
// Validate the contents of the record's disk location and deduplicate
//
if (!_seenInCurrentExtent.insert(_currRecord).second) {
error() << "infinite loop in extent, seen: " << _currRecord << " before" << endl;
_currRecord = DiskLoc();
continue;
}
if (_currRecord.getOfs() <= 0){
error() << "offset is 0 for record which should be impossible" << endl;
_currRecord = DiskLoc();
continue;
}
return retVal.toRecordId();
}
}
示例2:
RecordId SimpleRecordStoreV1Iterator::getNext() {
DiskLoc ret = _curr;
// Move to the next thing.
if (!isEOF()) {
if (CollectionScanParams::FORWARD == _direction) {
_curr = _recordStore->getNextRecord( _txn, _curr );
}
else {
_curr = _recordStore->getPrevRecord( _txn, _curr );
}
}
return ret.toRecordId();
}