diff options
author | Aaron <aaron@10gen.com> | 2010-10-19 10:42:29 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-10-19 10:42:29 -0700 |
commit | 0f38c2376d4015584dd3bd6ed90242a7f11cd440 (patch) | |
tree | bc5a2ee15356368fef5415f16d71d19bbf427881 /db/btree.h | |
parent | 015faa0b605a2de0c05460aa8822ea11b10d99a8 (diff) | |
parent | 552e94d71d2db6ccad2b123e551db805f08970a4 (diff) | |
download | mongo-0f38c2376d4015584dd3bd6ed90242a7f11cd440.tar.gz |
merge
Diffstat (limited to 'db/btree.h')
-rw-r--r-- | db/btree.h | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/db/btree.h b/db/btree.h index 4fcd04a4555..ba28d642890 100644 --- a/db/btree.h +++ b/db/btree.h @@ -253,18 +253,9 @@ namespace mongo { class BtreeCursor : public Cursor { public: BtreeCursor( NamespaceDetails *_d, int _idxNo, const IndexDetails&, const BSONObj &startKey, const BSONObj &endKey, bool endKeyInclusive, int direction ); - BtreeCursor( NamespaceDetails *_d, int _idxNo, const IndexDetails& _id, const shared_ptr< FieldRangeVector > &_bounds, int _direction ); - ~BtreeCursor(){ - } - virtual bool ok() { - return !bucket.isNull(); - } - bool eof() { - return !ok(); - } + virtual bool ok() { return !bucket.isNull(); } virtual bool advance(); - virtual void noteLocation(); // updates keyAtKeyOfs... virtual void checkLocation(); virtual bool supportGetMore() { return true; } @@ -278,7 +269,7 @@ namespace mongo { */ virtual bool getsetdup(DiskLoc loc) { if( multikey ) { - pair<set<DiskLoc>::iterator, bool> p = dups.insert(loc); + pair<set<DiskLoc>::iterator, bool> p = _dups.insert(loc); return !p.second; } return false; @@ -296,7 +287,6 @@ namespace mongo { } virtual BSONObj currKey() const { return currKeyNode().key; } - virtual BSONObj indexKeyPattern() { return indexDetails.keyPattern(); } virtual void aboutToDeleteBucket(const DiskLoc& b) { @@ -304,22 +294,14 @@ namespace mongo { keyOfs = -1; } - virtual DiskLoc currLoc() { - return !bucket.isNull() ? _currKeyNode().recordLoc : DiskLoc(); - } - virtual DiskLoc refLoc() { - return currLoc(); - } - virtual Record* _current() { - return currLoc().rec(); - } - virtual BSONObj current() { - return BSONObj(_current()); - } + virtual DiskLoc currLoc() { return !bucket.isNull() ? _currKeyNode().recordLoc : DiskLoc(); } + virtual DiskLoc refLoc() { return currLoc(); } + virtual Record* _current() { return currLoc().rec(); } + virtual BSONObj current() { return BSONObj(_current()); } virtual string toString() { string s = string("BtreeCursor ") + indexDetails.indexName(); if ( direction < 0 ) s += " reverse"; - if ( bounds_.get() && bounds_->size() > 1 ) s += " multi"; + if ( _bounds.get() && _bounds->size() > 1 ) s += " multi"; return s; } @@ -331,7 +313,7 @@ namespace mongo { if ( !_independentFieldRanges ) { return BSON( "start" << prettyKey( startKey ) << "end" << prettyKey( endKey ) ); } else { - return bounds_->obj(); + return _bounds->obj(); } } @@ -339,9 +321,7 @@ namespace mongo { virtual CoveredIndexMatcher *matcher() const { return _matcher.get(); } - virtual void setMatcher( shared_ptr< CoveredIndexMatcher > matcher ) { - _matcher = matcher; - } + virtual void setMatcher( shared_ptr< CoveredIndexMatcher > matcher ) { _matcher = matcher; } virtual long long nscanned() { return _nscanned; } @@ -367,25 +347,23 @@ namespace mongo { void advanceTo( const BSONObj &keyBegin, int keyBeginLen, bool afterKey, const vector< const BSONElement * > &keyEnd, const vector< bool > &keyEndInclusive ); friend class BtreeBucket; - set<DiskLoc> dups; - NamespaceDetails *d; - int idxNo; - + + set<DiskLoc> _dups; + NamespaceDetails * const d; + const int idxNo; BSONObj startKey; BSONObj endKey; - bool endKeyInclusive_; - + bool _endKeyInclusive; bool multikey; // note this must be updated every getmore batch in case someone added a multikey... - const IndexDetails& indexDetails; - BSONObj order; - Ordering _ordering; + const BSONObj _order; + const Ordering _ordering; DiskLoc bucket; int keyOfs; - int direction; // 1=fwd,-1=reverse + const int direction; // 1=fwd,-1=reverse BSONObj keyAtKeyOfs; // so we can tell if things moved around on us between the query and the getMore call DiskLoc locAtKeyOfs; - shared_ptr< FieldRangeVector > bounds_; + const shared_ptr< FieldRangeVector > _bounds; auto_ptr< FieldRangeVector::Iterator > _boundsIterator; const IndexSpec& _spec; shared_ptr< CoveredIndexMatcher > _matcher; |