当前位置: 首页>>代码示例>>C++>>正文


C++ DiskLoc::toRecordId方法代码示例

本文整理汇总了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();
        }
    }
开发者ID:3rf,项目名称:mongo,代码行数:56,代码来源:record_store_v1_repair_iterator.cpp

示例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();
    }
开发者ID:3rf,项目名称:mongo,代码行数:15,代码来源:record_store_v1_simple_iterator.cpp


注:本文中的DiskLoc::toRecordId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。