diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-11-15 14:10:17 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-11-15 14:39:56 -0500 |
commit | b577363aee00670bcffa5870708ab534ec4bf886 (patch) | |
tree | dd3f03ce701e41a1efd9b93d49b26084047e680f | |
parent | 0813c481afb6f6d8f9736df84351e237ef31ee5f (diff) | |
download | mongo-b577363aee00670bcffa5870708ab534ec4bf886.tar.gz |
remove CursorIterator
-rw-r--r-- | db/dbhelpers.cpp | 40 | ||||
-rw-r--r-- | db/dbhelpers.h | 16 | ||||
-rw-r--r-- | s/s_only.cpp | 6 |
3 files changed, 0 insertions, 62 deletions
diff --git a/db/dbhelpers.cpp b/db/dbhelpers.cpp index 5e04731f258..1fa90cb29b7 100644 --- a/db/dbhelpers.cpp +++ b/db/dbhelpers.cpp @@ -28,39 +28,6 @@ namespace mongo { - CursorIterator::CursorIterator( shared_ptr<Cursor> c , BSONObj filter ) - : _cursor( c ){ - if ( ! filter.isEmpty() ) - _matcher.reset( new CoveredIndexMatcher( filter , BSONObj() ) ); - _advance(); - } - - BSONObj CursorIterator::next(){ - BSONObj o = _o; - _advance(); - return o; - } - - bool CursorIterator::hasNext(){ - return ! _o.isEmpty(); - } - - void CursorIterator::_advance(){ - if ( ! _cursor->ok() ){ - _o = BSONObj(); - return; - } - - while ( _cursor->ok() ){ - _o = _cursor->current(); - _cursor->advance(); - if ( _matcher.get() == 0 || _matcher->matches( _o ) ) - return; - } - - _o = BSONObj(); - } - void Helpers::ensureIndex(const char *ns, BSONObj keyPattern, bool unique, const char *name) { NamespaceDetails *d = nsdetails(ns); if( d == 0 ) @@ -157,13 +124,6 @@ namespace mongo { return res->loc(); } - auto_ptr<CursorIterator> Helpers::find( const char *ns , BSONObj query , bool requireIndex ){ - uassert( 10047 , "requireIndex not supported in Helpers::find yet" , ! requireIndex ); - auto_ptr<CursorIterator> i; - i.reset( new CursorIterator( DataFileMgr::findAll( ns ) , query ) ); - return i; - } - bool Helpers::findById(Client& c, const char *ns, BSONObj query, BSONObj& result , bool * nsFound , bool * indexFound ){ dbMutex.assertAtLeastReadLocked(); diff --git a/db/dbhelpers.h b/db/dbhelpers.h index 981506a2966..d952613396e 100644 --- a/db/dbhelpers.h +++ b/db/dbhelpers.h @@ -33,20 +33,6 @@ namespace mongo { class Cursor; class CoveredIndexMatcher; - class CursorIterator { - public: - CursorIterator( shared_ptr<Cursor> c , BSONObj filter = BSONObj() ); - BSONObj next(); - bool hasNext(); - - private: - void _advance(); - - shared_ptr<Cursor> _cursor; - auto_ptr<CoveredIndexMatcher> _matcher; - BSONObj _o; - }; - /** all helpers assume locking is handled above them */ @@ -90,8 +76,6 @@ namespace mongo { @return null loc if not found */ static DiskLoc findById(NamespaceDetails *d, BSONObj query); - static auto_ptr<CursorIterator> find( const char *ns , BSONObj query = BSONObj() , bool requireIndex = false ); - /** Get/put the first (or last) object from a collection. Generally only useful if the collection only ever has a single object -- which is a "singleton collection". diff --git a/s/s_only.cpp b/s/s_only.cpp index c91ba10bfac..45b2a5e0cee 100644 --- a/s/s_only.cpp +++ b/s/s_only.cpp @@ -27,12 +27,6 @@ */ namespace mongo { - auto_ptr<CursorIterator> Helpers::find( const char *ns , BSONObj query , bool requireIndex ){ - uassert( 10196 , "Helpers::find can't be used in mongos" , 0 ); - auto_ptr<CursorIterator> i; - return i; - } - boost::thread_specific_ptr<Client> currentClient; Client::Client(const char *desc , MessagingPort *p) : |