#include <dbclientcursor.h>
Public Member Functions | |
void | attach (AScopedConnection *conn) |
DBClientCursor (DBClientBase *client, const string &_ns, long long _cursorId, int _nToReturn, int options) | |
DBClientCursor (DBClientBase *client, const string &_ns, BSONObj _query, int _nToReturn, int _nToSkip, const BSONObj *_fieldsToReturn, int queryOptions, int bs) | |
void | decouple () |
long long | getCursorId () const |
bool | hasResultFlag (int flag) |
bool | isDead () const |
int | itcount () |
bool | more () |
bool | moreInCurrentBatch () |
BSONObj | next () |
BSONObj | nextSafe () |
int | objsLeftInBatch () const |
void | peek (vector< BSONObj > &, int atMost) |
void | putBack (const BSONObj &o) |
bool | tailable () const |
virtual | ~DBClientCursor () |
Private Member Functions | |
void | _assertIfNull () const |
void | dataReceived () |
DBClientCursor (const DBClientCursor &) | |
void | exhaustReceiveMore () |
bool | init () |
int | nextBatchSize () |
DBClientCursor & | operator= (const DBClientCursor &) |
void | requestMore () |
Private Attributes | |
DBClientBase * | _client |
bool | _ownCursor |
stack< BSONObj > | _putBack |
string | _scopedHost |
int | batchSize |
long long | cursorId |
const char * | data |
const BSONObj * | fieldsToReturn |
bool | haveLimit |
auto_ptr< Message > | m |
int | nReturned |
string | ns |
int | nToReturn |
int | nToSkip |
int | opts |
int | pos |
BSONObj | query |
int | resultFlags |
Friends | |
class | DBClientBase |
class | DBClientConnection |
Queries return a cursor object
Definition at line 45 of file dbclientcursor.h.
mongo::DBClientCursor::DBClientCursor | ( | DBClientBase * | client, | |
const string & | _ns, | |||
BSONObj | _query, | |||
int | _nToReturn, | |||
int | _nToSkip, | |||
const BSONObj * | _fieldsToReturn, | |||
int | queryOptions, | |||
int | bs | |||
) | [inline] |
Definition at line 124 of file dbclientcursor.h.
mongo::DBClientCursor::DBClientCursor | ( | DBClientBase * | client, | |
const string & | _ns, | |||
long long | _cursorId, | |||
int | _nToReturn, | |||
int | options | |||
) | [inline] |
Definition at line 143 of file dbclientcursor.h.
virtual mongo::DBClientCursor::~DBClientCursor | ( | ) | [virtual] |
mongo::DBClientCursor::DBClientCursor | ( | const DBClientCursor & | ) | [private] |
void mongo::DBClientCursor::_assertIfNull | ( | ) | const [inline, private] |
Definition at line 196 of file dbclientcursor.h.
void mongo::DBClientCursor::attach | ( | AScopedConnection * | conn | ) |
void mongo::DBClientCursor::dataReceived | ( | ) | [private] |
void mongo::DBClientCursor::decouple | ( | ) | [inline] |
by default we "own" the cursor and will send the server a KillCursor message when ~DBClientCursor() is called. This function overrides that.
Definition at line 164 of file dbclientcursor.h.
void mongo::DBClientCursor::exhaustReceiveMore | ( | ) | [private] |
long long mongo::DBClientCursor::getCursorId | ( | ) | const [inline] |
Definition at line 159 of file dbclientcursor.h.
bool mongo::DBClientCursor::hasResultFlag | ( | int | flag | ) | [inline] |
see ResultFlagType (constants.h) for flag values mostly these flags are for internal purposes - ResultFlag_ErrSet is the possible exception to that
Definition at line 119 of file dbclientcursor.h.
bool mongo::DBClientCursor::init | ( | ) | [private] |
bool mongo::DBClientCursor::isDead | ( | ) | const [inline] |
cursor no longer valid -- use with tailable cursors. note you should only rely on this once more() returns false; 'dead' may be preset yet some data still queued and locally available from the dbclientcursor.
Definition at line 107 of file dbclientcursor.h.
int mongo::DBClientCursor::itcount | ( | ) | [inline] |
iterate the rest of the cursor and return the number if items
Definition at line 93 of file dbclientcursor.h.
bool mongo::DBClientCursor::more | ( | ) | [virtual] |
If true, safe to call next(). Requests more from server if necessary.
Implements mongo::DBClientCursorInterface.
bool mongo::DBClientCursor::moreInCurrentBatch | ( | ) | [inline] |
Definition at line 56 of file dbclientcursor.h.
BSONObj mongo::DBClientCursor::next | ( | ) | [virtual] |
next
Implements mongo::DBClientCursorInterface.
int mongo::DBClientCursor::nextBatchSize | ( | ) | [private] |
BSONObj mongo::DBClientCursor::nextSafe | ( | ) | [inline] |
throws AssertionException if get back { $err : ... }
Definition at line 72 of file dbclientcursor.h.
int mongo::DBClientCursor::objsLeftInBatch | ( | ) | const [inline] |
If true, there is more in our local buffers to be fetched via next(). Returns false when a getMore request back to server would be required. You can use this if you want to exhaust whatever data has been fetched to the client already but then perhaps stop.
Definition at line 55 of file dbclientcursor.h.
DBClientCursor& mongo::DBClientCursor::operator= | ( | const DBClientCursor & | ) | [private] |
void mongo::DBClientCursor::peek | ( | vector< BSONObj > & | , | |
int | atMost | |||
) |
peek ahead at items buffered for future next() calls. never requests new data from the server. so peek only effective with what is already buffered. WARNING: no support for _putBack yet!
void mongo::DBClientCursor::putBack | ( | const BSONObj & | o | ) | [inline] |
restore an object previously returned by next() to the cursor
Definition at line 69 of file dbclientcursor.h.
void mongo::DBClientCursor::requestMore | ( | ) | [private] |
bool mongo::DBClientCursor::tailable | ( | ) | const [inline] |
Definition at line 111 of file dbclientcursor.h.
friend class DBClientBase [friend] |
Definition at line 169 of file dbclientcursor.h.
friend class DBClientConnection [friend] |
Definition at line 170 of file dbclientcursor.h.
DBClientBase* mongo::DBClientCursor::_client [private] |
Definition at line 173 of file dbclientcursor.h.
bool mongo::DBClientCursor::_ownCursor [private] |
Definition at line 192 of file dbclientcursor.h.
stack< BSONObj > mongo::DBClientCursor::_putBack [private] |
Definition at line 183 of file dbclientcursor.h.
string mongo::DBClientCursor::_scopedHost [private] |
Definition at line 193 of file dbclientcursor.h.
int mongo::DBClientCursor::batchSize [private] |
Definition at line 181 of file dbclientcursor.h.
long long mongo::DBClientCursor::cursorId [private] |
Definition at line 185 of file dbclientcursor.h.
const char* mongo::DBClientCursor::data [private] |
Definition at line 188 of file dbclientcursor.h.
const BSONObj* mongo::DBClientCursor::fieldsToReturn [private] |
Definition at line 179 of file dbclientcursor.h.
bool mongo::DBClientCursor::haveLimit [private] |
Definition at line 177 of file dbclientcursor.h.
auto_ptr<Message> mongo::DBClientCursor::m [private] |
Definition at line 182 of file dbclientcursor.h.
int mongo::DBClientCursor::nReturned [private] |
Definition at line 186 of file dbclientcursor.h.
string mongo::DBClientCursor::ns [private] |
Definition at line 174 of file dbclientcursor.h.
int mongo::DBClientCursor::nToReturn [private] |
Definition at line 176 of file dbclientcursor.h.
int mongo::DBClientCursor::nToSkip [private] |
Definition at line 178 of file dbclientcursor.h.
int mongo::DBClientCursor::opts [private] |
Definition at line 180 of file dbclientcursor.h.
int mongo::DBClientCursor::pos [private] |
Definition at line 187 of file dbclientcursor.h.
BSONObj mongo::DBClientCursor::query [private] |
Definition at line 175 of file dbclientcursor.h.
int mongo::DBClientCursor::resultFlags [private] |
Definition at line 184 of file dbclientcursor.h.