示例#1
0
    void BtreeCursor::init(  const shared_ptr< FieldRangeVector > &bounds, int singleIntervalLimit, int direction ) {
        _finishConstructorInit();
        _bounds = bounds;
        verify( _bounds );
        _direction = direction;
        _endKeyInclusive = true;
        _boundsIterator.reset( new FieldRangeVectorIterator( *_bounds , singleIntervalLimit ) );
        _independentFieldRanges = true;
        dassert( d->idxNo((IndexDetails&) indexDetails) == idxNo );
        startKey = _bounds->startKey();
        _boundsIterator->advance( startKey ); // handles initialization
        _boundsIterator->prepDive();

        _indexDescriptor.reset(CatalogHack::getDescriptor(d, idxNo));
        _indexAM.reset(CatalogHack::getBtreeIndex(_indexDescriptor.get()));

        IndexCursor *cursor;
        _indexAM->newCursor(&cursor);
        _indexCursor.reset(cursor);

        CursorOptions opts;
        opts.direction = _direction == 1 ? CursorOptions::INCREASING : CursorOptions::DECREASING;
        _indexCursor->setOptions(opts);

        _indexCursor->seek(_boundsIterator->cmp(), _boundsIterator->inc());
        _hitEnd = false;
        skipAndCheck();
        dassert( _dups.size() == 0 );
    }
示例#2
0
 void BtreeCursor::init( const BSONObj& sk, const BSONObj& ek, bool endKeyInclusive, int direction ) {
     _finishConstructorInit();
     startKey = sk;
     endKey = ek;
     _endKeyInclusive =  endKeyInclusive;
     _direction = direction;
     _independentFieldRanges = false;
     audit();
 }
示例#3
0
 void BtreeCursor::init(  const shared_ptr< FieldRangeVector > &bounds, int singleIntervalLimit, int direction ) {
     _finishConstructorInit();
     _bounds = bounds;
     verify( _bounds );
     _direction = direction;
     _endKeyInclusive = true;
     _boundsIterator.reset( new FieldRangeVectorIterator( *_bounds , singleIntervalLimit ) );
     _independentFieldRanges = true;
     audit();
     startKey = _bounds->startKey();
     _boundsIterator->advance( startKey ); // handles initialization
     _boundsIterator->prepDive();
     bucket = indexDetails.head;
     keyOfs = 0;
 }
示例#4
0
    void BtreeCursor::init( const BSONObj& sk, const BSONObj& ek, bool endKeyInclusive, int direction ) {
        _finishConstructorInit();
        startKey = sk;
        endKey = ek;
        _endKeyInclusive =  endKeyInclusive;
        _direction = direction;
        _independentFieldRanges = false;
        dassert( d->idxNo((IndexDetails&) indexDetails) == idxNo );

        _indexDescriptor.reset(CatalogHack::getDescriptor(d, idxNo));
        _indexAM.reset(CatalogHack::getBtreeIndex(_indexDescriptor.get()));

        IndexCursor *cursor;
        _indexAM->newCursor(&cursor);
        _indexCursor.reset(cursor);

        CursorOptions opts;
        opts.direction = _direction == 1 ? CursorOptions::INCREASING : CursorOptions::DECREASING;
        cursor->setOptions(opts);

        _hitEnd = false;
    }