void init( const shared_ptr< FieldRangeVector >& bounds, int singleIntervalLimit, int direction ) { BtreeCursor::init(bounds,singleIntervalLimit,direction ); pair< DiskLoc, int > noBestParent; indexDetails.head.btree<V>()->customLocate( bucket, keyOfs, startKey, 0, false, _boundsIterator->cmp(), _boundsIterator->inc(), _ordering, direction, noBestParent ); skipAndCheck(); dassert( _dups.size() == 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 ); }
BtreeCursorImpl(NamespaceDetails *_d, int _idxNo, const IndexDetails& _id, const shared_ptr< FieldRangeVector > &_bounds, int _direction ) : BtreeCursor(_d,_idxNo,_id,_bounds,_direction ) { pair< DiskLoc, int > noBestParent; indexDetails.head.btree<V>()->customLocate( bucket, keyOfs, startKey, 0, false, _boundsIterator->cmp(), _boundsIterator->inc(), _ordering, _direction, noBestParent ); skipAndCheck(); dassert( _dups.size() == 0 ); }
bool BtreeCursor::advance() { killCurrentOp.checkForInterrupt(); if ( bucket.isNull() ) return false; bucket = bucket.btree()->advance(bucket, keyOfs, direction, "BtreeCursor::advance"); if ( !_independentFieldRanges ) { skipUnusedKeys( false ); checkEnd(); return ok(); } skipAndCheck(); return ok(); }
bool BtreeCursor::advance() { killCurrentOp.checkForInterrupt(); if ( bucket.isNull() ) return false; bucket = _advance(bucket, keyOfs, _direction, "BtreeCursor::advance"); if ( !_independentFieldRanges ) { skipUnusedKeys(); checkEnd(); if ( ok() ) { ++_nscanned; } } else { skipAndCheck(); } return ok(); }
bool BtreeCursor::advance() { // Reset this flag at the start of a new iteration. _boundsMustMatch = true; killCurrentOp.checkForInterrupt(); if ( bucket.isNull() ) return false; bucket = _advance(bucket, keyOfs, _direction, "BtreeCursor::advance"); if ( !_independentFieldRanges ) { skipUnusedKeys(); checkEnd(); if ( ok() ) { ++_nscanned; } } else { skipAndCheck(); } return ok(); }
bool BtreeCursor::advance() { // Reset this flag at the start of a new iteration. _boundsMustMatch = true; killCurrentOp.checkForInterrupt(); if (!ok()) { return false; } _indexCursor->next(); if ( !_independentFieldRanges ) { checkEnd(); if ( ok() ) { ++_nscanned; } } else { skipAndCheck(); } return ok(); }
BtreeCursor::BtreeCursor( NamespaceDetails *_d, int _idxNo, const IndexDetails& _id, const shared_ptr< FieldRangeVector > &_bounds, int _direction ) : d(_d), idxNo(_idxNo), endKeyInclusive_( true ), multikey( d->isMultikey( idxNo ) ), indexDetails( _id ), order( _id.keyPattern() ), _ordering( Ordering::make( order ) ), direction( _direction ), bounds_( ( assert( _bounds.get() ), _bounds ) ), _boundsIterator( new FieldRangeVector::Iterator( *bounds_ ) ), _spec( _id.getSpec() ), _independentFieldRanges( true ) { massert( 13384, "BtreeCursor FieldRangeVector constructor doesn't accept special indexes", !_spec.getType() ); audit(); startKey = bounds_->startKey(); bool found; _boundsIterator->advance( startKey ); // handles initialization bucket = indexDetails.head.btree()-> locate(indexDetails, indexDetails.head, startKey, _ordering, keyOfs, found, direction > 0 ? minDiskLoc : maxDiskLoc, direction); skipAndCheck(); DEV assert( dups.size() == 0 ); }