diff options
Diffstat (limited to 'src/mongo/db/dbdirectclient.h')
-rw-r--r-- | src/mongo/db/dbdirectclient.h | 106 |
1 files changed, 52 insertions, 54 deletions
diff --git a/src/mongo/db/dbdirectclient.h b/src/mongo/db/dbdirectclient.h index 835b63eab46..d34f1d2379c 100644 --- a/src/mongo/db/dbdirectclient.h +++ b/src/mongo/db/dbdirectclient.h @@ -34,77 +34,75 @@ namespace mongo { - class OperationContext; +class OperationContext; - /** - * Embedded calls to the local server using the DBClientBase API without going over the network. - * - * Caller does not need to lock, that is handled within. - * - * All operations are performed within the scope of a passed-in OperationContext (except when - * using the deprecated constructor). You must ensure that the OperationContext is valid when - * calling into any function. If you ever need to change the OperationContext, that can be done - * without the overhead of creating a new DBDirectClient by calling setOpCtx(), after which all - * operations will use the new OperationContext. - */ - class DBDirectClient : public DBClientBase { - public: - static const HostAndPort dummyHost; +/** + * Embedded calls to the local server using the DBClientBase API without going over the network. + * + * Caller does not need to lock, that is handled within. + * + * All operations are performed within the scope of a passed-in OperationContext (except when + * using the deprecated constructor). You must ensure that the OperationContext is valid when + * calling into any function. If you ever need to change the OperationContext, that can be done + * without the overhead of creating a new DBDirectClient by calling setOpCtx(), after which all + * operations will use the new OperationContext. + */ +class DBDirectClient : public DBClientBase { +public: + static const HostAndPort dummyHost; + + DBDirectClient(OperationContext* txn); + + using DBClientBase::query; - DBDirectClient(OperationContext* txn); + // XXX: is this valid or useful? + void setOpCtx(OperationContext* txn); - using DBClientBase::query; + virtual std::unique_ptr<DBClientCursor> query(const std::string& ns, + Query query, + int nToReturn = 0, + int nToSkip = 0, + const BSONObj* fieldsToReturn = 0, + int queryOptions = 0, + int batchSize = 0); - // XXX: is this valid or useful? - void setOpCtx(OperationContext* txn); + virtual bool isFailed() const; - virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, - Query query, - int nToReturn = 0, - int nToSkip = 0, - const BSONObj* fieldsToReturn = 0, - int queryOptions = 0, - int batchSize = 0); + virtual bool isStillConnected(); - virtual bool isFailed() const; + virtual std::string toString() const; - virtual bool isStillConnected(); + virtual std::string getServerAddress() const; - virtual std::string toString() const; + virtual bool call(Message& toSend, + Message& response, + bool assertOk = true, + std::string* actualServer = 0); - virtual std::string getServerAddress() const; + virtual void say(Message& toSend, bool isRetry = false, std::string* actualServer = 0); - virtual bool call(Message& toSend, - Message& response, - bool assertOk = true, - std::string* actualServer = 0); + virtual void sayPiggyBack(Message& toSend); - virtual void say(Message& toSend, - bool isRetry = false, - std::string* actualServer = 0); + virtual void killCursor(long long cursorID); - virtual void sayPiggyBack(Message& toSend); + virtual bool callRead(Message& toSend, Message& response); - virtual void killCursor(long long cursorID); + virtual unsigned long long count(const std::string& ns, + const BSONObj& query = BSONObj(), + int options = 0, + int limit = 0, + int skip = 0); - virtual bool callRead(Message& toSend, Message& response); - - virtual unsigned long long count(const std::string &ns, - const BSONObj& query = BSONObj(), - int options = 0, - int limit = 0, - int skip = 0); - - virtual ConnectionString::ConnectionType type() const; + virtual ConnectionString::ConnectionType type() const; - double getSoTimeout() const; + double getSoTimeout() const; - virtual bool lazySupported() const; + virtual bool lazySupported() const; - virtual QueryOptions _lookupAvailableOptions(); + virtual QueryOptions _lookupAvailableOptions(); - private: - OperationContext* _txn; - }; +private: + OperationContext* _txn; +}; } // namespace mongo |