diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-12-30 18:03:52 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-01-05 09:51:27 -0500 |
commit | 3a1c3daecc80ffecba3a1ab9fc49e770ace3ea8f (patch) | |
tree | c721ab53313ba02e31bc40c414dfb0460f4394d4 /src/mongo/client/dbclientinterface.h | |
parent | b3c4511611635692a46da21b7f9fc0e5131d1ef8 (diff) | |
download | mongo-3a1c3daecc80ffecba3a1ab9fc49e770ace3ea8f.tar.gz |
SERVER-22055 Remove unused client functionality
Diffstat (limited to 'src/mongo/client/dbclientinterface.h')
-rw-r--r-- | src/mongo/client/dbclientinterface.h | 115 |
1 files changed, 35 insertions, 80 deletions
diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h index 1dc383b1c30..a4e23c3f7e5 100644 --- a/src/mongo/client/dbclientinterface.h +++ b/src/mongo/client/dbclientinterface.h @@ -137,14 +137,6 @@ enum InsertOptions { InsertOption_ContinueOnError = 1 << 0 }; -/** - * Start from *top* of bits, these are generic write options that apply to all - */ -enum WriteOptions { - /** logical writeback option */ - WriteOption_FromWriteback = 1 << 31 -}; - // // For legacy reasons, the reserved field pre-namespace of certain types of messages is used // to store options as opposed to the flags after the namespace. This should be transparent to @@ -153,7 +145,6 @@ enum WriteOptions { enum ReservedOptions { Reserved_InsertOption_ContinueOnError = 1 << 0, - Reserved_FromWriteback = 1 << 1 }; class DBClientCursor; @@ -394,37 +385,6 @@ std::string nsGetDB(const std::string& ns); std::string nsGetCollection(const std::string& ns); /** - interface that handles communication with the db - */ -class DBConnector { -public: - virtual ~DBConnector() {} - /** actualServer is set to the actual server where they call went if there was a choice - * (SlaveOk) */ - virtual bool call(Message& toSend, - Message& response, - bool assertOk = true, - std::string* actualServer = 0) = 0; - virtual void say(Message& toSend, bool isRetry = false, std::string* actualServer = 0) = 0; - /* used by QueryOption_Exhaust. To use that your subclass must implement this. */ - virtual bool recv(Message& m) { - verify(false); - return false; - } - // In general, for lazy queries, we'll need to say, recv, then checkResponse - virtual void checkResponse(const char* data, - int nReturned, - bool* retry = NULL, - std::string* targetHost = NULL) { - if (retry) - *retry = false; - if (targetHost) - *targetHost = ""; - } - virtual bool lazySupported() const = 0; -}; - -/** The interface that any db connection should implement */ class DBClientInterface { @@ -443,8 +403,6 @@ public: virtual void insert(const std::string& ns, const std::vector<BSONObj>& v, int flags = 0) = 0; - virtual void remove(const std::string& ns, Query query, bool justOne = 0) = 0; - virtual void remove(const std::string& ns, Query query, int flags) = 0; virtual void update(const std::string& ns, @@ -493,7 +451,7 @@ protected: DB "commands" Basically just invocations of connection.$cmd.findOne({...}); */ -class DBClientWithCommands : public DBClientInterface, public DBConnector { +class DBClientWithCommands : public DBClientInterface { public: /** controls how chatty the client is about network errors & such. See log.h */ logger::LogSeverity _logLevel; @@ -517,6 +475,38 @@ public: void setClientRPCProtocols(rpc::ProtocolSet clientProtocols); /** + * actualServer is set to the actual server where they call went if there was a choice (for + * example SlaveOk). + */ + virtual bool call(Message& toSend, + Message& response, + bool assertOk = true, + std::string* actualServer = nullptr) = 0; + + virtual void say(Message& toSend, + bool isRetry = false, + std::string* actualServer = nullptr) = 0; + + /* used by QueryOption_Exhaust. To use that your subclass must implement this. */ + virtual bool recv(Message& m) { + verify(false); + return false; + } + + // In general, for lazy queries, we'll need to say, recv, then checkResponse + virtual void checkResponse(const char* data, + int nReturned, + bool* retry = nullptr, + std::string* targetHost = nullptr) { + if (retry) + *retry = false; + if (targetHost) + *targetHost = ""; + } + + virtual bool lazySupported() const = 0; + + /** * Sets a RequestMetadataWriter on this connection. * * TODO: support multiple metadata writers. @@ -715,14 +705,6 @@ public: */ BSONObj getPrevError(); - /** Reset the previous error state for this connection (accessed via getLastError and - getPrevError). Useful when performing several operations at once and then checking - for an error after attempting all operations. - */ - bool resetError() { - return simpleCommand("admin", 0, "reseterror"); - } - /** Delete the specified collection. * @param info An optional output parameter that receives the result object the database * returns from the drop command. May be null if the caller doesn't need that info. @@ -741,13 +723,6 @@ public: return res; } - /** Perform a repair and compaction of the specified database. May take a long time to run. - * Disk space must be available equal to the size of the database while repairing. - */ - bool repairDatabase(const std::string& dbname, BSONObj* info = 0) { - return simpleCommand(dbname, info, "repairDatabase"); - } - /** Copy database from one server or name to another server or name. Generally, you should dropDatabase() first as otherwise the copied information will MERGE @@ -1050,13 +1025,7 @@ public: virtual void update(const std::string& ns, Query query, BSONObj obj, int flags); - /** - remove matching objects from the database - @param justOne if this true, then once a single match is found will stop - */ - virtual void remove(const std::string& ns, Query q, bool justOne = 0); - - virtual void remove(const std::string& ns, Query query, int flags); + virtual void remove(const std::string& ns, Query query, int flags = 0); virtual bool isFailed() const = 0; @@ -1067,8 +1036,6 @@ public: virtual void killCursor(long long cursorID); - virtual bool callRead(Message& toSend, Message& response) = 0; - virtual ConnectionString::ConnectionType type() const = 0; virtual double getSoTimeout() const = 0; @@ -1081,11 +1048,6 @@ public: }; // DBClientBase -class ConnectException : public UserException { -public: - ConnectException(std::string msg) : UserException(9000, msg) {} -}; - /** A basic connection to the database. This is the main entry point for talking to a simple Mongo setup @@ -1237,19 +1199,13 @@ public: return _serverAddress; } - virtual bool callRead(Message& toSend, Message& response) { - return call(toSend, response); - } virtual void say(Message& toSend, bool isRetry = false, std::string* actualServer = 0); virtual bool recv(Message& m); virtual void checkResponse(const char* data, int nReturned, bool* retry = NULL, std::string* host = NULL); - virtual bool call(Message& toSend, - Message& response, - bool assertOk = true, - std::string* actualServer = 0); + virtual bool call(Message& toSend, Message& response, bool assertOk, std::string* actualServer); virtual ConnectionString::ConnectionType type() const { return ConnectionString::MASTER; } @@ -1278,7 +1234,6 @@ protected: int _minWireVersion{0}; int _maxWireVersion{0}; - friend class SyncClusterConnection; virtual void _auth(const BSONObj& params); std::unique_ptr<MessagingPort> _port; |