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


C++ DiskLoc函数代码示例

本文整理汇总了C++中DiskLoc函数的典型用法代码示例。如果您正苦于以下问题:C++ DiskLoc函数的具体用法?C++ DiskLoc怎么用?C++ DiskLoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DiskLoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DiskLoc

    DiskLoc RocksRecordStore::Iterator::getNext() {
        if ( !_iterator->Valid() ) {
            return DiskLoc();
        }

        DiskLoc toReturn = curr();

        if ( _forward() )
            _iterator->Next();
        else
            _iterator->Prev();

        return toReturn;
    }
开发者ID:CheRuisiBesares,项目名称:mongo,代码行数:14,代码来源:rocks_record_store.cpp

示例2: BSONObj

 /* fetch a single object from collection ns that matches query
    set your db SavedContext first
 */
 DiskLoc Helpers::findOne(const StringData& ns, const BSONObj &query, bool requireIndex) {
     shared_ptr<Cursor> c =
         NamespaceDetailsTransient::getCursor( ns.data() , query, BSONObj(),
                                               requireIndex ?
                                               QueryPlanSelectionPolicy::indexOnly() :
                                               QueryPlanSelectionPolicy::any() );
     while( c->ok() ) {
         if ( c->currentMatches() && !c->getsetdup( c->currLoc() ) ) {
             return c->currLoc();
         }
         c->advance();
     }
     return DiskLoc();
 }
开发者ID:phelipemaia,项目名称:mongo,代码行数:17,代码来源:dbhelpers.cpp

示例3: DiskLoc

    /* fetch a single object from collection ns that matches query
       set your db SavedContext first
    */
    DiskLoc Helpers::findOne(Collection* collection, const BSONObj &query, bool requireIndex) {
        if ( !collection )
            return DiskLoc();

        CanonicalQuery* cq;
        const WhereCallbackReal whereCallback(collection->ns().db());

        massert(17244, "Could not canonicalize " + query.toString(),
            CanonicalQuery::canonicalize(collection->ns(), query, &cq, whereCallback).isOK());

        Runner* rawRunner;
        size_t options = requireIndex ? QueryPlannerParams::NO_TABLE_SCAN : QueryPlannerParams::DEFAULT;
        massert(17245, "Could not get runner for query " + query.toString(),
                getRunner(collection, cq, &rawRunner, options).isOK());

        auto_ptr<Runner> runner(rawRunner);
        Runner::RunnerState state;
        DiskLoc loc;
        if (Runner::RUNNER_ADVANCED == (state = runner->getNext(NULL, &loc))) {
            return loc;
        }
        return DiskLoc();
    }
开发者ID:vigneshncc,项目名称:mongo,代码行数:26,代码来源:dbhelpers.cpp

示例4: iterator

    int64_t Collection::countTableScan( const MatchExpression* expression ) {
        scoped_ptr<RecordIterator> iterator( getIterator( DiskLoc(),
                                                              false,
                                                              CollectionScanParams::FORWARD ) );
        int64_t count = 0;
        while ( !iterator->isEOF() ) {
            DiskLoc loc = iterator->getNext();
            BSONObj obj = docFor( loc );
            if ( expression->matchesBSON( obj ) )
                count++;
        }

        return count;
    }
开发者ID:BeyondMyself,项目名称:mongo,代码行数:14,代码来源:collection.cpp

示例5: setDeletedListEntry

 DummyRecordStoreV1MetaData::DummyRecordStoreV1MetaData( bool capped, int userFlags ) {
     _dataSize = 0;
     _numRecords = 0;
     _capped = capped;
     _userFlags = userFlags;
     _lastExtentSize = 0;
     _paddingFactor = 1;
     _maxCappedDocs = numeric_limits<long long>::max();
     _capFirstNewRecord.setInvalid();
     if ( _capped ) {
         // copied from NamespaceDetails::NamespaceDetails()
         setDeletedListEntry( NULL, 1, DiskLoc().setInvalid() );
     }
 }
开发者ID:AndrewCEmil,项目名称:mongo,代码行数:14,代码来源:record_store_v1_test_help.cpp

示例6: DiskLoc

 void CappedIterator::invalidate(const DiskLoc& dl) {
     if ((_tailable && _curr.isNull() && dl == _prev) || (dl == _curr)) {
         // In the _tailable case, we're about to kill the DiskLoc that we're tailing.  Nothing
         // that we can possibly do to survive that.
         //
         // In the _curr case, we *could* move to the next thing, since there is actually a next
         // thing, but according to clientcursor.cpp:
         // "note we cannot advance here. if this condition occurs, writes to the oplog
         //  have "caught" the reader.  skipping ahead, the reader would miss postentially
         //  important data."
         _curr = _prev = DiskLoc();
         _killedByInvalidate = true;
     }
 }
开发者ID:bukamanush,项目名称:mongo,代码行数:14,代码来源:collection_iterator.cpp

示例7: keyAt

        virtual void keyAt(DiskLoc thisLoc, int pos, BSONObj& key, DiskLoc& recordLoc) {
            recordLoc = DiskLoc();
            const BtreeBucket<V>* bucket = thisLoc.btree<V>();
            int n = bucket->nKeys();

            if( pos < 0 || pos >= n || n == 0xffff /* bucket deleted */ || ! bucket->isUsed( pos ) ){
                // log() << "Pos: " << pos << " n " << n << endl;
                return;
            }

            typename BtreeBucket<V>::KeyNode kn = bucket->keyNode(pos);
            key = kn.key.toBson();
            recordLoc = kn.recordLoc;
        }
开发者ID:mindcrusher11,项目名称:mongo,代码行数:14,代码来源:index.cpp

示例8: _cmp

    BSONObjExternalSorter::Iterator::Iterator( BSONObjExternalSorter * sorter ) :
        _cmp( sorter->_order ) , _in( 0 ){
        
        for ( list<string>::iterator i=sorter->_files.begin(); i!=sorter->_files.end(); i++ ){
            _files.push_back( new FileIterator( *i ) );
            _stash.push_back( pair<Data,bool>( Data( BSONObj() , DiskLoc() ) , false ) );
        }
        
        if ( _files.size() == 0 && sorter->_cur ){
            _in = sorter->_cur;
            _it = sorter->_cur->begin();
        }

        
    }
开发者ID:kapouer,项目名称:mongo-debian,代码行数:15,代码来源:extsort.cpp

示例9: verify

    void OplogStart::invalidate(const DiskLoc& dl, InvalidationType type) {
        if (_needInit) { return; }

        if (INVALIDATION_DELETION != type) { return; }

        if (_backwardsScanning) {
            _cs->invalidate(dl, type);
        }
        else {
            verify(_extentHopping);
            if (dl == _curloc) {
                _curloc = DiskLoc();
            }
        }
    }
开发者ID:AshishThakur,项目名称:mongo,代码行数:15,代码来源:oplogstart.cpp

示例10: customLocate

 virtual void customLocate(const BSONObj& keyBegin,
                           int keyBeginLen,
                           bool afterKey,
                           const vector<const BSONElement*>& keyEnd,
                           const vector<bool>& keyEndInclusive) {
     // makeQueryObject handles stripping of fieldnames for us.
     _it = lower_bound(IndexEntry(IndexEntryComparison::makeQueryObject(
                                       keyBegin,
                                       keyBeginLen,
                                       afterKey,
                                       keyEnd,
                                       keyEndInclusive,
                                       -1), // reverse
                                  DiskLoc()));
 }
开发者ID:Benguang,项目名称:mongo,代码行数:15,代码来源:heap1_btree_impl.cpp

示例11: Status

    // static
    Status ProjectionExecutor::applyFindSyntax(const FindProjection* proj, WorkingSetMember* wsm) {
        BSONObjBuilder bob;
        if (proj->_includeID) {
            BSONElement elt;
            if (!wsm->getFieldDotted("_id", &elt)) {
                return Status(ErrorCodes::BadValue, "Couldn't get _id field in proj");
            }
            bob.append(elt);
        }

        if (proj->_includedFields.size() > 0) {
            // We only want stuff in _fields.
            const vector<string>& fields = proj->_includedFields;
            for (size_t i = 0; i < fields.size(); ++i) {
                BSONElement elt;
                // We can project a field that doesn't exist.  We just ignore it.
                // UNITTEST 11738048
                if (wsm->getFieldDotted(fields[i], &elt) && !elt.eoo()) {
                    // TODO: This fails utterly for dotted fields.  Fix.
                    bob.appendAs(elt, fields[i]);
                }
            }
        }
        else if (proj->_excludedFields.size() > 0) {
            // We want stuff NOT in _fields.  This can't be covered, so we expect an obj.
            if (!wsm->hasObj()) {
                return Status(ErrorCodes::BadValue,
                        "exclusion specified for projection but no obj to iter over");
            }
            const unordered_set<string>& fields = proj->_excludedFields;
            BSONObjIterator it(wsm->obj);
            while (it.more()) {
                BSONElement elt = it.next();
                if (!mongoutils::str::equals("_id", elt.fieldName())) {
                    if (fields.end() == fields.find(elt.fieldName())) {
                        bob.append(elt);
                    }
                }
            }
        }

        wsm->state = WorkingSetMember::OWNED_OBJ;
        wsm->obj = bob.obj();
        wsm->keyData.clear();
        wsm->loc = DiskLoc();
        return Status::OK();
    }
开发者ID:Cassie90,项目名称:mongo,代码行数:48,代码来源:projection_executor.cpp

示例12: invariant

    Status ProjectionStage::transform(WorkingSetMember* member) {
        // The default no-fast-path case.
        if (ProjectionStageParams::NO_FAST_PATH == _projImpl) {
            return _exec->transform(member);
        }

        BSONObjBuilder bob;

        // Note that even if our fast path analysis is bug-free something that is
        // covered might be invalidated and just be an obj.  In this case we just go
        // through the SIMPLE_DOC path which is still correct if the covered data
        // is not available.
        //
        // SIMPLE_DOC implies that we expect an object so it's kind of redundant.
        if ((ProjectionStageParams::SIMPLE_DOC == _projImpl) || member->hasObj()) {
            // If we got here because of SIMPLE_DOC the planner shouldn't have messed up.
            invariant(member->hasObj());

            // Apply the SIMPLE_DOC projection.
            transformSimpleInclusion(member->obj, _includedFields, bob);
        }
        else {
            invariant(ProjectionStageParams::COVERED_ONE_INDEX == _projImpl);
            // We're pulling data out of the key.
            invariant(1 == member->keyData.size());
            size_t keyIndex = 0;

            // Look at every key element...
            BSONObjIterator keyIterator(member->keyData[0].keyData);
            while (keyIterator.more()) {
                BSONElement elt = keyIterator.next();
                // If we're supposed to include it...
                if (_includeKey[keyIndex]) {
                    // Do so.
                    bob.appendAs(elt, _keyFieldNames[keyIndex]);
                }
                ++keyIndex;
            }
        }

        member->state = WorkingSetMember::OWNED_OBJ;
        member->keyData.clear();
        member->loc = DiskLoc();
        member->obj = bob.obj();
        return Status::OK();
    }
开发者ID:Robbie1977,项目名称:mongo,代码行数:46,代码来源:projection.cpp

示例13: currKey

 bool BtreeCursor::skipOutOfRangeKeysAndCheckEnd() {
     if ( !ok() ) {
         return false;
     }
     int ret = _boundsIterator->advance( currKey() );
     if ( ret == -2 ) {
         bucket = DiskLoc();
         return false;
     }
     else if ( ret == -1 ) {
         ++_nscanned;
         return false;
     }
     ++_nscanned;
     advanceTo( currKey(), ret, _boundsIterator->after(), _boundsIterator->cmp(), _boundsIterator->inc() );
     return true;
 }
开发者ID:FrancescaK,项目名称:mongo,代码行数:17,代码来源:btreecursor.cpp

示例14: wassert

    ClientCursor::~ClientCursor() {
        if( _pos == -2 ) {
            // defensive: destructor called twice
            wassert(false);
            return;
        }

        {
            recursive_scoped_lock lock(ccmutex);
            setLastLoc_inlock( DiskLoc() ); // removes us from bylocation multimap
            clientCursorsById.erase(_cursorid);

            // defensive:
            (CursorId&)_cursorid = -1;
            _pos = -2;
        }
    }
开发者ID:jfensign,项目名称:mongo,代码行数:17,代码来源:clientcursor.cpp

示例15: keyAndRecordAt

 virtual void keyAndRecordAt(DiskLoc bucket, int keyOffset, BSONObj* keyOut,
                             DiskLoc* recordOut) const {
     verify(!bucket.isNull());
     const BtreeBucket<Version> *b = bucket.btree<Version>();
     int n = b->getN();
     if (n == b->INVALID_N_SENTINEL) {
         throw UserException(deletedBucketCode, "keyAt bucket deleted");
     }
     dassert( n >= 0 && n < 10000 );
     if (keyOffset >= n) {
         *keyOut = BSONObj();
         *recordOut = DiskLoc();
     } else {
         *keyOut = b->keyNode(keyOffset).key.toBson();
         *recordOut = b->keyNode(keyOffset).recordLoc;
     }
 }
开发者ID:10genReviews,项目名称:mongo,代码行数:17,代码来源:btree_interface.cpp


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