diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2018-06-19 15:09:01 -0400 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2018-06-29 11:57:55 -0400 |
commit | cfa96795eefed2061628891c43ccdc2c256bb40a (patch) | |
tree | 110d230d14a7a60fa8b7ce937a77def7af98f1ef | |
parent | 40ad396238fdfb87a7a86e26020db2d293d23f40 (diff) | |
download | mongo-cfa96795eefed2061628891c43ccdc2c256bb40a.tar.gz |
SERVER-35115 Separate dbclientinterface.h into several parts, one per class.
117 files changed, 554 insertions, 485 deletions
diff --git a/src/mongo/client/SConscript b/src/mongo/client/SConscript index 2a49afcd2ca..43af0a24e0e 100644 --- a/src/mongo/client/SConscript +++ b/src/mongo/client/SConscript @@ -152,8 +152,8 @@ clientDriverEnv.InjectThirdPartyIncludePaths('asio') clientDriverEnv.Library( target='clientdriver_minimal', source=[ - 'dbclient.cpp', - 'dbclientcursor.cpp', + 'dbclient_base.cpp', + 'dbclient_cursor.cpp', 'index_spec.cpp', ], LIBDEPS=[ diff --git a/src/mongo/client/connection_pool.h b/src/mongo/client/connection_pool.h index a359b47bfce..bd461f1bedb 100644 --- a/src/mongo/client/connection_pool.h +++ b/src/mongo/client/connection_pool.h @@ -31,7 +31,7 @@ #include <map> #include "mongo/base/disallow_copying.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/stdx/list.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" diff --git a/src/mongo/client/connection_string_connect.cpp b/src/mongo/client/connection_string_connect.cpp index d824fa6be78..c91b25b969e 100644 --- a/src/mongo/client/connection_string_connect.cpp +++ b/src/mongo/client/connection_string_connect.cpp @@ -35,7 +35,6 @@ #include <memory> #include "mongo/client/dbclient_rs.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/mongo_uri.h" #include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/client/connpool.cpp b/src/mongo/client/connpool.cpp index 57f75accc05..b999502c8c5 100644 --- a/src/mongo/client/connpool.cpp +++ b/src/mongo/client/connpool.cpp @@ -41,6 +41,7 @@ #include "mongo/base/init.h" #include "mongo/client/connection_string.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/client/global_conn_pool.h" #include "mongo/client/replica_set_monitor.h" #include "mongo/executor/connection_pool_stats.h" diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h index 9d428dcab36..d6813fa6017 100644 --- a/src/mongo/client/connpool.h +++ b/src/mongo/client/connpool.h @@ -32,7 +32,7 @@ #include <cstdint> #include <stack> -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/client/mongo_uri.h" #include "mongo/platform/atomic_word.h" #include "mongo/util/background.h" diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient_base.cpp index e5ef508b1db..2f756132c3f 100644 --- a/src/mongo/client/dbclient.cpp +++ b/src/mongo/client/dbclient_base.cpp @@ -31,7 +31,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include <algorithm> #include <utility> @@ -42,7 +42,7 @@ #include "mongo/bson/util/builder.h" #include "mongo/client/authenticate.h" #include "mongo/client/constants.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/config.h" #include "mongo/db/auth/internal_user_auth.h" #include "mongo/db/commands.h" diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclient_base.h index 7978d1c1a0d..4b09d7bae37 100644 --- a/src/mongo/client/dbclientinterface.h +++ b/src/mongo/client/dbclient_base.h @@ -32,6 +32,7 @@ #include "mongo/base/string_data.h" #include "mongo/client/connection_string.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/client/index_spec.h" #include "mongo/client/mongo_uri.h" #include "mongo/client/query.h" @@ -58,106 +59,6 @@ namespace executor { struct RemoteCommandResponse; } -class DBClientCursor; -class DBClientCursorBatchIterator; - -/** - * Represents a full query description, including all options required for the query to be passed on - * to other hosts - */ -class QuerySpec { - std::string _ns; - int _ntoskip; - int _ntoreturn; - int _options; - BSONObj _query; - BSONObj _fields; - Query _queryObj; - -public: - QuerySpec(const std::string& ns, - const BSONObj& query, - const BSONObj& fields, - int ntoskip, - int ntoreturn, - int options) - : _ns(ns), - _ntoskip(ntoskip), - _ntoreturn(ntoreturn), - _options(options), - _query(query.getOwned()), - _fields(fields.getOwned()), - _queryObj(_query) {} - - QuerySpec() {} - - bool isEmpty() const { - return _ns.size() == 0; - } - - bool isExplain() const { - return _queryObj.isExplain(); - } - BSONObj filter() const { - return _queryObj.getFilter(); - } - - BSONObj hint() const { - return _queryObj.getHint(); - } - BSONObj sort() const { - return _queryObj.getSort(); - } - BSONObj query() const { - return _query; - } - BSONObj fields() const { - return _fields; - } - BSONObj* fieldsData() { - return &_fields; - } - - // don't love this, but needed downstrem - const BSONObj* fieldsPtr() const { - return &_fields; - } - - std::string ns() const { - return _ns; - } - int ntoskip() const { - return _ntoskip; - } - int ntoreturn() const { - return _ntoreturn; - } - int options() const { - return _options; - } - - void setFields(BSONObj& o) { - _fields = o.getOwned(); - } - - std::string toString() const { - return str::stream() << "QSpec " - << BSON("ns" << _ns << "n2skip" << _ntoskip << "n2return" << _ntoreturn - << "options" - << _options - << "query" - << _query - << "fields" - << _fields); - } -}; - - -/** Typically one uses the QUERY(...) macro to construct a Query object. - Example: QUERY( "age" << 33 << "school" << "UCLA" ) -*/ -#define QUERY(x) ::mongo::Query(BSON(x)) - // Useful utilities for namespaces /** @return the database name portion of an ns std::string */ std::string nsGetDB(const std::string& ns); @@ -862,266 +763,7 @@ private: bool _haveCachedAvailableOptions; }; // DBClientBase -/** - A basic connection to the database. - This is the main entry point for talking to a simple Mongo setup -*/ -class DBClientConnection : public DBClientBase { -public: - using DBClientBase::query; - - /** - * A hook used to validate the reply of an 'isMaster' command during connection. If the hook - * returns a non-OK Status, the DBClientConnection object will disconnect from the remote - * server. This function must not throw - it can only indicate failure by returning a non-OK - * status. - */ - using HandshakeValidationHook = - stdx::function<Status(const executor::RemoteCommandResponse& isMasterReply)>; - - /** - @param _autoReconnect if true, automatically reconnect on a connection failure - @param timeout tcp timeout in seconds - this is for read/write, not connect. - Connect timeout is fixed, but short, at 5 seconds. - */ - DBClientConnection(bool _autoReconnect = false, - double so_timeout = 0, - MongoURI uri = {}, - const HandshakeValidationHook& hook = HandshakeValidationHook()); - - virtual ~DBClientConnection() { - _numConnections.fetchAndAdd(-1); - } - - /** - * Connect to a Mongo database server. - * - * If autoReconnect is true, you can try to use the DBClientConnection even when - * false was returned -- it will try to connect again. - * - * @param server server to connect to. - * @param errmsg any relevant error message will appended to the string - * @return false if fails to connect. - */ - virtual bool connect(const HostAndPort& server, - StringData applicationName, - std::string& errmsg); - - /** - * Semantically equivalent to the previous connect method, but returns a Status - * instead of taking an errmsg out parameter. Also allows optional validation of the reply to - * the 'isMaster' command executed during connection. - * - * @param server The server to connect to. - * @param a hook to validate the 'isMaster' reply received during connection. If the hook - * fails, the connection will be terminated and a non-OK status will be returned. - */ - Status connect(const HostAndPort& server, StringData applicationName); - - /** - * This version of connect does not run 'isMaster' after creating a TCP connection to the - * remote host. This method should be used only when calling 'isMaster' would create a deadlock, - * such as in 'isSelf'. - * - * @param server The server to connect to. - */ - Status connectSocketOnly(const HostAndPort& server); - - /** Connect to a Mongo database server. Exception throwing version. - Throws a AssertionException if cannot connect. - - If autoReconnect is true, you can try to use the DBClientConnection even when - false was returned -- it will try to connect again. - - @param serverHostname host to connect to. can include port number ( 127.0.0.1 , - 127.0.0.1:5555 ) - */ - - /** - * Logs out the connection for the given database. - * - * @param dbname the database to logout from. - * @param info the result object for the logout command (provided for backwards - * compatibility with mongo shell) - */ - virtual void logout(const std::string& dbname, BSONObj& info); - - virtual std::unique_ptr<DBClientCursor> query(const std::string& ns, - Query query = Query(), - int nToReturn = 0, - int nToSkip = 0, - const BSONObj* fieldsToReturn = 0, - int queryOptions = 0, - int batchSize = 0) { - checkConnection(); - return DBClientBase::query( - ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions, batchSize); - } - - virtual unsigned long long query(stdx::function<void(DBClientCursorBatchIterator&)> f, - const std::string& ns, - Query query, - const BSONObj* fieldsToReturn, - int queryOptions); - - using DBClientBase::runCommandWithTarget; - std::pair<rpc::UniqueReply, DBClientBase*> runCommandWithTarget(OpMsgRequest request) override; - std::pair<rpc::UniqueReply, std::shared_ptr<DBClientBase>> runCommandWithTarget( - OpMsgRequest request, std::shared_ptr<DBClientBase> me) override; - - rpc::UniqueReply parseCommandReplyMessage(const std::string& host, - const Message& replyMsg) override; - - /** - @return true if this connection is currently in a failed state. When autoreconnect is on, - a connection will transition back to an ok state after reconnecting. - */ - bool isFailed() const { - return _failed; - } - - bool isStillConnected(); - - void setTags(transport::Session::TagMask tag); - - void shutdown(); - - void setWireVersions(int minWireVersion, int maxWireVersion) { - _minWireVersion = minWireVersion; - _maxWireVersion = maxWireVersion; - } - - int getMinWireVersion() final { - return _minWireVersion; - } - - int getMaxWireVersion() final { - return _maxWireVersion; - } - - std::string toString() const { - std::stringstream ss; - ss << _serverAddress; - if (!_resolvedAddress.empty()) - ss << " (" << _resolvedAddress << ")"; - if (_failed) - ss << " failed"; - return ss.str(); - } - - std::string getServerAddress() const { - return _serverAddress.toString(); - } - const HostAndPort& getServerHostAndPort() const { - return _serverAddress; - } - - virtual void say(Message& toSend, bool isRetry = false, std::string* actualServer = 0); - virtual bool recv(Message& m, int lastRequestId); - virtual void checkResponse(const std::vector<BSONObj>& batch, - bool networkError, - bool* retry = NULL, - std::string* host = NULL); - virtual bool call(Message& toSend, Message& response, bool assertOk, std::string* actualServer); - virtual ConnectionString::ConnectionType type() const { - return ConnectionString::MASTER; - } - void setSoTimeout(double timeout); - double getSoTimeout() const { - return _socketTimeout.value_or(Milliseconds{0}).count() / 1000.0; - } - - virtual bool lazySupported() const { - return true; - } - - static int getNumConnections() { - return _numConnections.load(); - } - - /** - * Set the name of the replica set that this connection is associated to. - * Note: There is no validation on replSetName. - */ - void setParentReplSetName(const std::string& replSetName); - - uint64_t getSockCreationMicroSec() const override; - - MessageCompressorManager& getCompressorManager() { - return _compressorManager; - } - - // throws a NetworkException if in failed state and not reconnecting or if waiting to reconnect - void checkConnection() override { - if (_failed) - _checkConnection(); - } - - bool isReplicaSetMember() const override { - return _isReplicaSetMember; - } - - bool isMongos() const override { - return _isMongos; - } - -protected: - int _minWireVersion{0}; - int _maxWireVersion{0}; - bool _isReplicaSetMember = false; - bool _isMongos = false; - - virtual void _auth(const BSONObj& params); - - transport::SessionHandle _session; - boost::optional<Milliseconds> _socketTimeout; - transport::Session::TagMask _tagMask = transport::Session::kEmptyTagMask; - uint64_t _sessionCreationMicros = INVALID_SOCK_CREATION_TIME; - Date_t _lastConnectivityCheck; - - bool _failed = false; - const bool autoReconnect; - Backoff autoReconnectBackoff; - - HostAndPort _serverAddress; - std::string _resolvedAddress; - std::string _applicationName; - - void _checkConnection(); - - std::map<std::string, BSONObj> authCache; - - static AtomicInt32 _numConnections; - -private: - /** - * Inspects the contents of 'replyBody' and informs the replica set monitor that the host 'this' - * is connected with is no longer the primary if a "not master" error message or error code was - * returned. - */ - void handleNotMasterResponse(const BSONObj& replyBody, StringData errorMsgFieldName); - enum FailAction { kSetFlag, kEndSession, kReleaseSession }; - void _markFailed(FailAction action); - - // Contains the string for the replica set name of the host this is connected to. - // Should be empty if this connection is not pointing to a replica set member. - std::string _parentReplSetName; - - // Hook ran on every call to connect() - HandshakeValidationHook _hook; - - MessageCompressorManager _compressorManager; - - MongoURI _uri; -}; - BSONElement getErrField(const BSONObj& result); bool hasErrField(const BSONObj& result); -inline std::ostream& operator<<(std::ostream& s, const Query& q) { - return s << q.toString(); -} - } // namespace mongo - -#include "mongo/client/dbclientcursor.h" diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp index cf7f0101407..62bfe45726d 100644 --- a/src/mongo/client/dbclient_connection.cpp +++ b/src/mongo/client/dbclient_connection.cpp @@ -31,7 +31,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_connection.h" #include <algorithm> #include <utility> @@ -42,7 +42,7 @@ #include "mongo/bson/util/builder.h" #include "mongo/client/authenticate.h" #include "mongo/client/constants.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/client/replica_set_monitor.h" #include "mongo/config.h" #include "mongo/db/auth/internal_user_auth.h" diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h new file mode 100644 index 00000000000..9958c2d3bbe --- /dev/null +++ b/src/mongo/client/dbclient_connection.h @@ -0,0 +1,321 @@ +/** + * Copyright (C) 2008-2015 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects + * for all of the code used other than as permitted herein. If you modify + * file(s) with this exception, you may extend this exception to your + * version of the file(s), but you are not obligated to do so. If you do not + * wish to do so, delete this exception statement from your version. If you + * delete this exception statement from all source files in the program, + * then also delete it in the license file. + */ + +#pragma once + +#include <cstdint> + +#include "mongo/base/string_data.h" +#include "mongo/client/connection_string.h" +#include "mongo/client/dbclient_base.h" +#include "mongo/client/index_spec.h" +#include "mongo/client/mongo_uri.h" +#include "mongo/client/query.h" +#include "mongo/client/read_preference.h" +#include "mongo/db/dbmessage.h" +#include "mongo/db/jsobj.h" +#include "mongo/db/write_concern_options.h" +#include "mongo/logger/log_severity.h" +#include "mongo/platform/atomic_word.h" +#include "mongo/rpc/message.h" +#include "mongo/rpc/metadata.h" +#include "mongo/rpc/op_msg.h" +#include "mongo/rpc/protocol.h" +#include "mongo/rpc/unique_message.h" +#include "mongo/stdx/functional.h" +#include "mongo/transport/message_compressor_manager.h" +#include "mongo/transport/session.h" +#include "mongo/transport/transport_layer.h" +#include "mongo/util/mongoutils/str.h" + +namespace mongo { + +namespace executor { +struct RemoteCommandResponse; +} + +class DBClientCursor; +class DBClientCursorBatchIterator; + +/** + A basic connection to the database. + This is the main entry point for talking to a simple Mongo setup +*/ +class DBClientConnection : public DBClientBase { +public: + using DBClientBase::query; + + /** + * A hook used to validate the reply of an 'isMaster' command during connection. If the hook + * returns a non-OK Status, the DBClientConnection object will disconnect from the remote + * server. This function must not throw - it can only indicate failure by returning a non-OK + * status. + */ + using HandshakeValidationHook = + stdx::function<Status(const executor::RemoteCommandResponse& isMasterReply)>; + + /** + @param _autoReconnect if true, automatically reconnect on a connection failure + @param timeout tcp timeout in seconds - this is for read/write, not connect. + Connect timeout is fixed, but short, at 5 seconds. + */ + DBClientConnection(bool _autoReconnect = false, + double so_timeout = 0, + MongoURI uri = {}, + const HandshakeValidationHook& hook = HandshakeValidationHook()); + + virtual ~DBClientConnection() { + _numConnections.fetchAndAdd(-1); + } + + /** + * Connect to a Mongo database server. + * + * If autoReconnect is true, you can try to use the DBClientConnection even when + * false was returned -- it will try to connect again. + * + * @param server server to connect to. + * @param errmsg any relevant error message will appended to the string + * @return false if fails to connect. + */ + virtual bool connect(const HostAndPort& server, + StringData applicationName, + std::string& errmsg); + + /** + * Semantically equivalent to the previous connect method, but returns a Status + * instead of taking an errmsg out parameter. Also allows optional validation of the reply to + * the 'isMaster' command executed during connection. + * + * @param server The server to connect to. + * @param a hook to validate the 'isMaster' reply received during connection. If the hook + * fails, the connection will be terminated and a non-OK status will be returned. + */ + Status connect(const HostAndPort& server, StringData applicationName); + + /** + * This version of connect does not run 'isMaster' after creating a TCP connection to the + * remote host. This method should be used only when calling 'isMaster' would create a deadlock, + * such as in 'isSelf'. + * + * @param server The server to connect to. + */ + Status connectSocketOnly(const HostAndPort& server); + + /** Connect to a Mongo database server. Exception throwing version. + Throws a AssertionException if cannot connect. + + If autoReconnect is true, you can try to use the DBClientConnection even when + false was returned -- it will try to connect again. + + @param serverHostname host to connect to. can include port number ( 127.0.0.1 , + 127.0.0.1:5555 ) + */ + + /** + * Logs out the connection for the given database. + * + * @param dbname the database to logout from. + * @param info the result object for the logout command (provided for backwards + * compatibility with mongo shell) + */ + virtual void logout(const std::string& dbname, BSONObj& info); + + virtual std::unique_ptr<DBClientCursor> query(const std::string& ns, + Query query = Query(), + int nToReturn = 0, + int nToSkip = 0, + const BSONObj* fieldsToReturn = 0, + int queryOptions = 0, + int batchSize = 0) { + checkConnection(); + return DBClientBase::query( + ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions, batchSize); + } + + virtual unsigned long long query(stdx::function<void(DBClientCursorBatchIterator&)> f, + const std::string& ns, + Query query, + const BSONObj* fieldsToReturn, + int queryOptions); + + using DBClientBase::runCommandWithTarget; + std::pair<rpc::UniqueReply, DBClientBase*> runCommandWithTarget(OpMsgRequest request) override; + std::pair<rpc::UniqueReply, std::shared_ptr<DBClientBase>> runCommandWithTarget( + OpMsgRequest request, std::shared_ptr<DBClientBase> me) override; + + rpc::UniqueReply parseCommandReplyMessage(const std::string& host, + const Message& replyMsg) override; + + /** + @return true if this connection is currently in a failed state. When autoreconnect is on, + a connection will transition back to an ok state after reconnecting. + */ + bool isFailed() const { + return _failed; + } + + bool isStillConnected(); + + void setTags(transport::Session::TagMask tag); + + void shutdown(); + + void setWireVersions(int minWireVersion, int maxWireVersion) { + _minWireVersion = minWireVersion; + _maxWireVersion = maxWireVersion; + } + + int getMinWireVersion() final { + return _minWireVersion; + } + + int getMaxWireVersion() final { + return _maxWireVersion; + } + + std::string toString() const { + std::stringstream ss; + ss << _serverAddress; + if (!_resolvedAddress.empty()) + ss << " (" << _resolvedAddress << ")"; + if (_failed) + ss << " failed"; + return ss.str(); + } + + std::string getServerAddress() const { + return _serverAddress.toString(); + } + const HostAndPort& getServerHostAndPort() const { + return _serverAddress; + } + + virtual void say(Message& toSend, bool isRetry = false, std::string* actualServer = 0); + virtual bool recv(Message& m, int lastRequestId); + virtual void checkResponse(const std::vector<BSONObj>& batch, + bool networkError, + bool* retry = NULL, + std::string* host = NULL); + virtual bool call(Message& toSend, Message& response, bool assertOk, std::string* actualServer); + virtual ConnectionString::ConnectionType type() const { + return ConnectionString::MASTER; + } + void setSoTimeout(double timeout); + double getSoTimeout() const { + return _socketTimeout.value_or(Milliseconds{0}).count() / 1000.0; + } + + virtual bool lazySupported() const { + return true; + } + + static int getNumConnections() { + return _numConnections.load(); + } + + /** + * Set the name of the replica set that this connection is associated to. + * Note: There is no validation on replSetName. + */ + void setParentReplSetName(const std::string& replSetName); + + uint64_t getSockCreationMicroSec() const override; + + MessageCompressorManager& getCompressorManager() { + return _compressorManager; + } + + // throws a NetworkException if in failed state and not reconnecting or if waiting to reconnect + void checkConnection() override { + if (_failed) + _checkConnection(); + } + + bool isReplicaSetMember() const override { + return _isReplicaSetMember; + } + + bool isMongos() const override { + return _isMongos; + } + +protected: + int _minWireVersion{0}; + int _maxWireVersion{0}; + bool _isReplicaSetMember = false; + bool _isMongos = false; + + virtual void _auth(const BSONObj& params); + + transport::SessionHandle _session; + boost::optional<Milliseconds> _socketTimeout; + transport::Session::TagMask _tagMask = transport::Session::kEmptyTagMask; + uint64_t _sessionCreationMicros = INVALID_SOCK_CREATION_TIME; + Date_t _lastConnectivityCheck; + + bool _failed = false; + const bool autoReconnect; + Backoff autoReconnectBackoff; + + HostAndPort _serverAddress; + std::string _resolvedAddress; + std::string _applicationName; + + void _checkConnection(); + + std::map<std::string, BSONObj> authCache; + + static AtomicInt32 _numConnections; + +private: + /** + * Inspects the contents of 'replyBody' and informs the replica set monitor that the host 'this' + * is connected with is no longer the primary if a "not master" error message or error code was + * returned. + */ + void handleNotMasterResponse(const BSONObj& replyBody, StringData errorMsgFieldName); + enum FailAction { kSetFlag, kEndSession, kReleaseSession }; + void _markFailed(FailAction action); + + // Contains the string for the replica set name of the host this is connected to. + // Should be empty if this connection is not pointing to a replica set member. + std::string _parentReplSetName; + + // Hook ran on every call to connect() + HandshakeValidationHook _hook; + + MessageCompressorManager _compressorManager; + + MongoURI _uri; +}; + +BSONElement getErrField(const BSONObj& result); +bool hasErrField(const BSONObj& result); + +} // namespace mongo diff --git a/src/mongo/client/dbclientcursor.cpp b/src/mongo/client/dbclient_cursor.cpp index 19d53c81a5a..bafdfea1990 100644 --- a/src/mongo/client/dbclientcursor.cpp +++ b/src/mongo/client/dbclient_cursor.cpp @@ -31,7 +31,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/client/connpool.h" #include "mongo/db/client.h" diff --git a/src/mongo/client/dbclientcursor.h b/src/mongo/client/dbclient_cursor.h index 876d3f30db7..36f5c20452a 100644 --- a/src/mongo/client/dbclientcursor.h +++ b/src/mongo/client/dbclient_cursor.h @@ -32,14 +32,16 @@ #include <stack> #include "mongo/base/disallow_copying.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/db/dbmessage.h" #include "mongo/db/jsobj.h" #include "mongo/db/json.h" +#include "mongo/db/namespace_string.h" #include "mongo/rpc/message.h" namespace mongo { class AScopedConnection; +class DBClientBase; /** Queries return a cursor object */ class DBClientCursor { diff --git a/src/mongo/client/dbclientmockcursor.h b/src/mongo/client/dbclient_mockcursor.h index a35437315d9..db711d738ea 100644 --- a/src/mongo/client/dbclientmockcursor.h +++ b/src/mongo/client/dbclient_mockcursor.h @@ -29,7 +29,7 @@ #pragma once -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" namespace mongo { diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp index 1946af5a162..2695730ab6b 100644 --- a/src/mongo/client/dbclient_rs.cpp +++ b/src/mongo/client/dbclient_rs.cpp @@ -36,7 +36,7 @@ #include "mongo/bson/util/builder.h" #include "mongo/client/connpool.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/client/global_conn_pool.h" #include "mongo/client/read_preference.h" #include "mongo/client/replica_set_monitor.h" diff --git a/src/mongo/client/dbclient_rs.h b/src/mongo/client/dbclient_rs.h index 05a5e09e4a9..27d0c3acb5a 100644 --- a/src/mongo/client/dbclient_rs.h +++ b/src/mongo/client/dbclient_rs.h @@ -31,7 +31,7 @@ #include <utility> -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/client/mongo_uri.h" #include "mongo/util/net/hostandport.h" diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp index 0b3a39975fa..d0fec97f3d2 100644 --- a/src/mongo/client/dbclient_rs_test.cpp +++ b/src/mongo/client/dbclient_rs_test.cpp @@ -42,7 +42,6 @@ #include "mongo/base/string_data.h" #include "mongo/client/connpool.h" #include "mongo/client/dbclient_rs.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/replica_set_monitor.h" #include "mongo/db/jsobj.h" #include "mongo/dbtests/mock/mock_conn_registry.h" diff --git a/src/mongo/client/index_spec.cpp b/src/mongo/client/index_spec.cpp index 25e800bf140..b0d4a2bc179 100644 --- a/src/mongo/client/index_spec.cpp +++ b/src/mongo/client/index_spec.cpp @@ -30,7 +30,8 @@ #include "mongo/client/index_spec.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" +#include "mongo/client/read_preference.h" namespace mongo { diff --git a/src/mongo/client/mongo_uri.cpp b/src/mongo/client/mongo_uri.cpp index 47ea195c362..021b98af098 100644 --- a/src/mongo/client/mongo_uri.cpp +++ b/src/mongo/client/mongo_uri.cpp @@ -41,7 +41,6 @@ #include "mongo/base/status_with.h" #include "mongo/bson/bsonobjbuilder.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/sasl_client_authenticate.h" #include "mongo/db/namespace_string.h" #include "mongo/stdx/utility.h" diff --git a/src/mongo/client/mongo_uri_connect.cpp b/src/mongo/client/mongo_uri_connect.cpp index 3f9ee296a6d..4ef8b7dc4a3 100644 --- a/src/mongo/client/mongo_uri_connect.cpp +++ b/src/mongo/client/mongo_uri_connect.cpp @@ -34,7 +34,7 @@ #include "mongo/base/status_with.h" #include "mongo/bson/bsonobjbuilder.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/db/auth/sasl_command_constants.h" #include "mongo/util/mongoutils/str.h" #include "mongo/util/password_digest.h" diff --git a/src/mongo/client/query.h b/src/mongo/client/query.h index 37af5b0659e..68e972063b9 100644 --- a/src/mongo/client/query.h +++ b/src/mongo/client/query.h @@ -159,6 +159,10 @@ private: } }; +inline std::ostream& operator<<(std::ostream& s, const Query& q) { + return s << q.toString(); +} + void assembleQueryRequest(const std::string& ns, BSONObj query, int nToReturn, @@ -167,4 +171,9 @@ void assembleQueryRequest(const std::string& ns, int queryOptions, Message& toSend); +/** Typically one uses the QUERY(...) macro to construct a Query object. +Example: QUERY( "age" << 33 << "school" << "UCLA" ) +*/ +#define QUERY(x) ::mongo::Query(BSON(x)) + } // namespace mongo diff --git a/src/mongo/client/query_spec.h b/src/mongo/client/query_spec.h new file mode 100644 index 00000000000..65de704737d --- /dev/null +++ b/src/mongo/client/query_spec.h @@ -0,0 +1,127 @@ +/** + * Copyright (C) 2008-2015 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects + * for all of the code used other than as permitted herein. If you modify + * file(s) with this exception, you may extend this exception to your + * version of the file(s), but you are not obligated to do so. If you do not + * wish to do so, delete this exception statement from your version. If you + * delete this exception statement from all source files in the program, + * then also delete it in the license file. + */ + +#pragma once + +#include "mongo/bson/bsonobj.h" +#include "mongo/client/query.h" +#include "mongo/util/mongoutils/str.h" + +namespace mongo { +/** + * Represents a full query description, including all options required for the query to be passed on + * to other hosts + */ +class QuerySpec { + std::string _ns; + int _ntoskip; + int _ntoreturn; + int _options; + BSONObj _query; + BSONObj _fields; + Query _queryObj; + +public: + QuerySpec(const std::string& ns, + const BSONObj& query, + const BSONObj& fields, + int ntoskip, + int ntoreturn, + int options) + : _ns(ns), + _ntoskip(ntoskip), + _ntoreturn(ntoreturn), + _options(options), + _query(query.getOwned()), + _fields(fields.getOwned()), + _queryObj(_query) {} + + QuerySpec() {} + + bool isEmpty() const { + return _ns.size() == 0; + } + + bool isExplain() const { + return _queryObj.isExplain(); + } + BSONObj filter() const { + return _queryObj.getFilter(); + } + + BSONObj hint() const { + return _queryObj.getHint(); + } + BSONObj sort() const { + return _queryObj.getSort(); + } + BSONObj query() const { + return _query; + } + BSONObj fields() const { + return _fields; + } + BSONObj* fieldsData() { + return &_fields; + } + + // don't love this, but needed downstrem + const BSONObj* fieldsPtr() const { + return &_fields; + } + + std::string ns() const { + return _ns; + } + int ntoskip() const { + return _ntoskip; + } + int ntoreturn() const { + return _ntoreturn; + } + int options() const { + return _options; + } + + void setFields(BSONObj& o) { + _fields = o.getOwned(); + } + + std::string toString() const { + return str::stream() << "QSpec " + << BSON("ns" << _ns << "n2skip" << _ntoskip << "n2return" << _ntoreturn + << "options" + << _options + << "query" + << _query + << "fields" + << _fields); + } +}; + +} // namespace mongo diff --git a/src/mongo/db/auth/authorization_session.h b/src/mongo/db/auth/authorization_session.h index c76ca0d70d5..5042a1fd7e5 100644 --- a/src/mongo/db/auth/authorization_session.h +++ b/src/mongo/db/auth/authorization_session.h @@ -41,6 +41,7 @@ #include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_set.h" #include "mongo/db/namespace_string.h" +#include "mongo/db/operation_context.h" namespace mongo { diff --git a/src/mongo/db/auth/authz_session_external_state.cpp b/src/mongo/db/auth/authz_session_external_state.cpp index 5985a1d54fe..f9ca8fe2d02 100644 --- a/src/mongo/db/auth/authz_session_external_state.cpp +++ b/src/mongo/db/auth/authz_session_external_state.cpp @@ -31,7 +31,6 @@ #include "mongo/db/auth/authz_session_external_state.h" #include "mongo/base/status.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/namespace_string.h" diff --git a/src/mongo/db/auth/authz_session_external_state.h b/src/mongo/db/auth/authz_session_external_state.h index bd8cde24fea..9b5ea8e4518 100644 --- a/src/mongo/db/auth/authz_session_external_state.h +++ b/src/mongo/db/auth/authz_session_external_state.h @@ -32,7 +32,6 @@ #include "mongo/base/disallow_copying.h" #include "mongo/base/status.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/user_name.h" diff --git a/src/mongo/db/auth/authz_session_external_state_d.cpp b/src/mongo/db/auth/authz_session_external_state_d.cpp index 5c5ef29f899..0b6fd980469 100644 --- a/src/mongo/db/auth/authz_session_external_state_d.cpp +++ b/src/mongo/db/auth/authz_session_external_state_d.cpp @@ -29,7 +29,6 @@ #include "mongo/db/auth/authz_session_external_state_d.h" #include "mongo/base/status.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/client.h" #include "mongo/db/jsobj.h" diff --git a/src/mongo/db/auth/authz_session_external_state_s.cpp b/src/mongo/db/auth/authz_session_external_state_s.cpp index 8f42eb3b30d..acfebe8aaa9 100644 --- a/src/mongo/db/auth/authz_session_external_state_s.cpp +++ b/src/mongo/db/auth/authz_session_external_state_s.cpp @@ -31,7 +31,6 @@ #include <string> #include "mongo/base/status.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/jsobj.h" #include "mongo/s/grid.h" diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp index 1f4c169000c..650dd5f576f 100644 --- a/src/mongo/db/catalog/index_create.cpp +++ b/src/mongo/db/catalog/index_create.cpp @@ -33,7 +33,6 @@ #include "mongo/db/catalog/index_create.h" #include "mongo/base/error_codes.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/audit.h" #include "mongo/db/background.h" #include "mongo/db/catalog/collection.h" diff --git a/src/mongo/db/catalog/index_create_impl.cpp b/src/mongo/db/catalog/index_create_impl.cpp index db5e653abef..7f3c45a2f28 100644 --- a/src/mongo/db/catalog/index_create_impl.cpp +++ b/src/mongo/db/catalog/index_create_impl.cpp @@ -34,7 +34,6 @@ #include "mongo/base/error_codes.h" #include "mongo/base/init.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/audit.h" #include "mongo/db/background.h" #include "mongo/db/catalog/collection.h" diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index a07e54e1524..59af3fc3929 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -30,7 +30,6 @@ #include <boost/optional.hpp> -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/user_name.h" #include "mongo/db/cursor_id.h" #include "mongo/db/jsobj.h" diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index ecff3ad592d..5208128d87d 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -36,7 +36,6 @@ #include "mongo/bson/unordered_fields_bsonobj_comparator.h" #include "mongo/bson/util/bson_extract.h" #include "mongo/bson/util/builder.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager_global.h" #include "mongo/db/auth/internal_user_auth.h" diff --git a/src/mongo/db/cloner.h b/src/mongo/db/cloner.h index 6ef53acd7ca..61c0694e8f3 100644 --- a/src/mongo/db/cloner.h +++ b/src/mongo/db/cloner.h @@ -34,7 +34,7 @@ #include <vector> #include "mongo/base/disallow_copying.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/db/catalog/collection_options.h" namespace mongo { diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp index f04d9bac576..3aa2c3ddc9e 100644 --- a/src/mongo/db/commands/clone_collection.cpp +++ b/src/mongo/db/commands/clone_collection.cpp @@ -33,7 +33,7 @@ #include "mongo/base/init.h" #include "mongo/base/status.h" #include "mongo/bson/util/builder.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/auth/resource_pattern.h" diff --git a/src/mongo/db/commands/conn_pool_stats.cpp b/src/mongo/db/commands/conn_pool_stats.cpp index f554b55302a..bf4559c19eb 100644 --- a/src/mongo/db/commands/conn_pool_stats.cpp +++ b/src/mongo/db/commands/conn_pool_stats.cpp @@ -33,6 +33,7 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/client/connpool.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/client/global_conn_pool.h" #include "mongo/db/commands.h" #include "mongo/db/repl/replication_coordinator.h" diff --git a/src/mongo/db/commands/copydb_start_commands.cpp b/src/mongo/db/commands/copydb_start_commands.cpp index fd3cb1c272a..e06116a9bd8 100644 --- a/src/mongo/db/commands/copydb_start_commands.cpp +++ b/src/mongo/db/commands/copydb_start_commands.cpp @@ -34,7 +34,6 @@ #include "mongo/base/status.h" #include "mongo/bson/util/bson_extract.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/auth/resource_pattern.h" diff --git a/src/mongo/db/commands/copydb_start_commands.h b/src/mongo/db/commands/copydb_start_commands.h index 5bf8b32c444..acefa16eefb 100644 --- a/src/mongo/db/commands/copydb_start_commands.h +++ b/src/mongo/db/commands/copydb_start_commands.h @@ -26,7 +26,7 @@ * it in the license file. */ -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" namespace mongo { diff --git a/src/mongo/db/commands/rename_collection_cmd.cpp b/src/mongo/db/commands/rename_collection_cmd.cpp index 2232104c44e..36c8aa4105b 100644 --- a/src/mongo/db/commands/rename_collection_cmd.cpp +++ b/src/mongo/db/commands/rename_collection_cmd.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/collection_catalog_entry.h" #include "mongo/db/catalog/database_holder.h" diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index 6d16c03c2a0..145cd247301 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -40,7 +40,6 @@ #include "mongo/bson/mutable/document.h" #include "mongo/bson/mutable/element.h" #include "mongo/bson/util/bson_extract.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/config.h" #include "mongo/crypto/mechanism_scram.h" #include "mongo/db/audit.h" diff --git a/src/mongo/db/dbdirectclient.h b/src/mongo/db/dbdirectclient.h index b410613cca5..b8f3ebc14d6 100644 --- a/src/mongo/db/dbdirectclient.h +++ b/src/mongo/db/dbdirectclient.h @@ -28,7 +28,7 @@ #pragma once -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/db/dbmessage.h" #include "mongo/db/lasterror.h" #include "mongo/util/net/hostandport.h" diff --git a/src/mongo/db/exec/idhack.cpp b/src/mongo/db/exec/idhack.cpp index a5c099c79be..d8f4f12ba82 100644 --- a/src/mongo/db/exec/idhack.cpp +++ b/src/mongo/db/exec/idhack.cpp @@ -30,7 +30,6 @@ #include "mongo/db/exec/idhack.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/projection.h" diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp index 532dea64044..41780eab96c 100644 --- a/src/mongo/db/exec/subplan.cpp +++ b/src/mongo/db/exec/subplan.cpp @@ -35,7 +35,6 @@ #include <memory> #include <vector> -#include "mongo/client/dbclientinterface.h" #include "mongo/db/exec/multi_plan.h" #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/matcher/extensions_callback_real.h" diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp index ba573531791..85664098e4d 100644 --- a/src/mongo/db/ops/update.cpp +++ b/src/mongo/db/ops/update.cpp @@ -34,7 +34,6 @@ #include "mongo/db/ops/update.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/database_holder.h" diff --git a/src/mongo/db/ops/write_ops_document_stream_integration_test.cpp b/src/mongo/db/ops/write_ops_document_stream_integration_test.cpp index 3ef382f3ef4..51cbf103722 100644 --- a/src/mongo/db/ops/write_ops_document_stream_integration_test.cpp +++ b/src/mongo/db/ops/write_ops_document_stream_integration_test.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/db/commands.h" #include "mongo/db/namespace_string.h" #include "mongo/rpc/get_status_from_command_result.h" diff --git a/src/mongo/db/ops/write_ops_parsers.cpp b/src/mongo/db/ops/write_ops_parsers.cpp index 30213225d0f..ee98d43d17f 100644 --- a/src/mongo/db/ops/write_ops_parsers.cpp +++ b/src/mongo/db/ops/write_ops_parsers.cpp @@ -30,7 +30,6 @@ #include "mongo/db/ops/write_ops_parsers.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/dbmessage.h" #include "mongo/db/ops/write_ops.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index ec1541d815f..7555f8a321d 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -39,7 +39,6 @@ #include "mongo/base/init.h" #include "mongo/bson/simple_bsonobj_comparator.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/collection_index_usage_tracker.h" #include "mongo/db/commands.h" #include "mongo/db/generic_cursor.h" diff --git a/src/mongo/db/pipeline/expression_context.h b/src/mongo/db/pipeline/expression_context.h index 495797b7575..0a01140c1c8 100644 --- a/src/mongo/db/pipeline/expression_context.h +++ b/src/mongo/db/pipeline/expression_context.h @@ -46,6 +46,7 @@ #include "mongo/db/query/datetime/date_time_support.h" #include "mongo/db/query/explain_options.h" #include "mongo/db/query/tailable_mode.h" +#include "mongo/db/server_options.h" #include "mongo/util/intrusive_counter.h" #include "mongo/util/string_map.h" #include "mongo/util/uuid.h" diff --git a/src/mongo/db/pipeline/mongo_process_interface.h b/src/mongo/db/pipeline/mongo_process_interface.h index dac98d07acc..6bde838b3ed 100644 --- a/src/mongo/db/pipeline/mongo_process_interface.h +++ b/src/mongo/db/pipeline/mongo_process_interface.h @@ -35,7 +35,7 @@ #include <string> #include <vector> -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/db/collection_index_usage_tracker.h" #include "mongo/db/generic_cursor.h" #include "mongo/db/namespace_string.h" diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index 9fec47e815d..18e442ea6f5 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -33,7 +33,6 @@ #include "mongo/db/pipeline/pipeline_d.h" #include "mongo/bson/simple_bsonobj_comparator.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp index 249a61349fb..1d3462bef36 100644 --- a/src/mongo/db/query/find.cpp +++ b/src/mongo/db/query/find.cpp @@ -33,7 +33,6 @@ #include "mongo/db/query/find.h" #include "mongo/base/error_codes.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/client.h" diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index 36ef683a600..aa7cbd4714e 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -38,7 +38,6 @@ #include "mongo/base/error_codes.h" #include "mongo/base/parse_number.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/exec/cached_plan.h" #include "mongo/db/exec/count.h" diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index 6a788719f50..36e3cbb7b52 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -38,7 +38,6 @@ #include <vector> #include "mongo/base/owned_pointer_vector.h" -#include "mongo/client/dbclientinterface.h" // For QueryOption_foobar #include "mongo/db/matcher/expression_array.h" #include "mongo/db/matcher/expression_geo.h" #include "mongo/db/query/collation/collator_interface.h" diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp index 5d65081b66e..e1bf324c0d9 100644 --- a/src/mongo/db/query/query_planner.cpp +++ b/src/mongo/db/query/query_planner.cpp @@ -37,7 +37,6 @@ #include "mongo/base/string_data.h" #include "mongo/bson/simple_bsonelement_comparator.h" -#include "mongo/client/dbclientinterface.h" // For QueryOption_foobar #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/matcher/expression_algo.h" #include "mongo/db/matcher/expression_geo.h" diff --git a/src/mongo/db/query/query_request.cpp b/src/mongo/db/query/query_request.cpp index 5a6225acacb..6f21e814c60 100644 --- a/src/mongo/db/query/query_request.cpp +++ b/src/mongo/db/query/query_request.cpp @@ -33,7 +33,6 @@ #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/bson/simple_bsonobj_comparator.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/catalog/uuid_catalog.h" #include "mongo/db/command_generic_argument.h" #include "mongo/db/commands.h" diff --git a/src/mongo/db/repl/isself.cpp b/src/mongo/db/repl/isself.cpp index 8b7f8daa751..eb52e2c45a2 100644 --- a/src/mongo/db/repl/isself.cpp +++ b/src/mongo/db/repl/isself.cpp @@ -36,7 +36,7 @@ #include "mongo/base/init.h" #include "mongo/bson/util/builder.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_type.h" #include "mongo/db/auth/authorization_manager.h" diff --git a/src/mongo/db/repl/oplog_interface_remote.cpp b/src/mongo/db/repl/oplog_interface_remote.cpp index a2f524466ab..e7e66beb2a4 100644 --- a/src/mongo/db/repl/oplog_interface_remote.cpp +++ b/src/mongo/db/repl/oplog_interface_remote.cpp @@ -30,7 +30,8 @@ #include "mongo/db/repl/oplog_interface_remote.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/jsobj.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp index 8e9d7bf304a..6ae234cb57b 100644 --- a/src/mongo/db/repl/oplogreader.cpp +++ b/src/mongo/db/repl/oplogreader.cpp @@ -34,7 +34,6 @@ #include <string> -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager_global.h" #include "mongo/db/auth/authorization_session.h" diff --git a/src/mongo/db/repl/oplogreader.h b/src/mongo/db/repl/oplogreader.h index 335771de867..d7c132fe2cd 100644 --- a/src/mongo/db/repl/oplogreader.h +++ b/src/mongo/db/repl/oplogreader.h @@ -31,7 +31,8 @@ #pragma once -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_connection.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/util/net/hostandport.h" namespace mongo { diff --git a/src/mongo/db/repl/roll_back_local_operations_test.cpp b/src/mongo/db/repl/roll_back_local_operations_test.cpp index 043f813e11b..6e7c4f1062b 100644 --- a/src/mongo/db/repl/roll_back_local_operations_test.cpp +++ b/src/mongo/db/repl/roll_back_local_operations_test.cpp @@ -31,8 +31,8 @@ #include <iterator> #include "mongo/client/connection_pool.h" -#include "mongo/client/dbclientinterface.h" -#include "mongo/client/dbclientmockcursor.h" +#include "mongo/client/dbclient_connection.h" +#include "mongo/client/dbclient_mockcursor.h" #include "mongo/db/client.h" #include "mongo/db/jsobj.h" #include "mongo/db/repl/oplog_interface_mock.h" diff --git a/src/mongo/db/repl/rollback_source_impl.cpp b/src/mongo/db/repl/rollback_source_impl.cpp index 677f3ef3155..b83feefd3ab 100644 --- a/src/mongo/db/repl/rollback_source_impl.cpp +++ b/src/mongo/db/repl/rollback_source_impl.cpp @@ -30,7 +30,6 @@ #include "mongo/db/repl/rollback_source_impl.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/cloner.h" #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" diff --git a/src/mongo/db/s/chunk_splitter.cpp b/src/mongo/db/s/chunk_splitter.cpp index efec5986aa5..a0fd9c60337 100644 --- a/src/mongo/db/s/chunk_splitter.cpp +++ b/src/mongo/db/s/chunk_splitter.cpp @@ -32,7 +32,7 @@ #include "mongo/db/s/chunk_splitter.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/client/query.h" #include "mongo/db/client.h" #include "mongo/db/dbdirectclient.h" diff --git a/src/mongo/db/s/session_catalog_migration_source.h b/src/mongo/db/s/session_catalog_migration_source.h index a020edd00a3..0ef285e5818 100644 --- a/src/mongo/db/s/session_catalog_migration_source.h +++ b/src/mongo/db/s/session_catalog_migration_source.h @@ -32,7 +32,7 @@ #include <memory> #include "mongo/base/disallow_copying.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/namespace_string.h" #include "mongo/db/repl/optime.h" #include "mongo/db/session_txn_record_gen.h" diff --git a/src/mongo/db/s/shard_metadata_util.cpp b/src/mongo/db/s/shard_metadata_util.cpp index 28384a70a85..b2f0c9352c9 100644 --- a/src/mongo/db/s/shard_metadata_util.cpp +++ b/src/mongo/db/s/shard_metadata_util.cpp @@ -32,7 +32,6 @@ #include "mongo/db/s/shard_metadata_util.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/ops/write_ops.h" #include "mongo/db/write_concern_options.h" diff --git a/src/mongo/db/s/shard_metadata_util_test.cpp b/src/mongo/db/s/shard_metadata_util_test.cpp index b6a397f26df..2b3b9fe5221 100644 --- a/src/mongo/db/s/shard_metadata_util_test.cpp +++ b/src/mongo/db/s/shard_metadata_util_test.cpp @@ -31,7 +31,6 @@ #include "mongo/db/s/shard_metadata_util.h" #include "mongo/base/status.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/remote_command_targeter_mock.h" #include "mongo/db/commands.h" #include "mongo/db/dbdirectclient.h" diff --git a/src/mongo/db/sessions_collection.cpp b/src/mongo/db/sessions_collection.cpp index 2464bc0b47b..cf8e0349a30 100644 --- a/src/mongo/db/sessions_collection.cpp +++ b/src/mongo/db/sessions_collection.cpp @@ -34,7 +34,7 @@ #include <vector> #include "mongo/bson/bsonobjbuilder.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/db/create_indexes_gen.h" #include "mongo/db/logical_session_id.h" #include "mongo/db/ops/write_ops.h" diff --git a/src/mongo/db/sessions_collection_rs.cpp b/src/mongo/db/sessions_collection_rs.cpp index 4f5c7a06905..d9c403696e2 100644 --- a/src/mongo/db/sessions_collection_rs.cpp +++ b/src/mongo/db/sessions_collection_rs.cpp @@ -34,7 +34,6 @@ #include <utility> #include "mongo/client/connection_string.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/query.h" #include "mongo/client/read_preference.h" #include "mongo/client/remote_command_targeter_factory_impl.h" diff --git a/src/mongo/db/sessions_collection_standalone.cpp b/src/mongo/db/sessions_collection_standalone.cpp index ea980b86beb..1f4b5ec17cf 100644 --- a/src/mongo/db/sessions_collection_standalone.cpp +++ b/src/mongo/db/sessions_collection_standalone.cpp @@ -30,7 +30,6 @@ #include "mongo/db/sessions_collection_standalone.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/query.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/operation_context.h" diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp index cbec62d92b5..62c529da26b 100644 --- a/src/mongo/dbtests/clienttests.cpp +++ b/src/mongo/dbtests/clienttests.cpp @@ -30,7 +30,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp index 37dadcdf485..975a446894a 100644 --- a/src/mongo/dbtests/dbhelper_tests.cpp +++ b/src/mongo/dbtests/dbhelper_tests.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database_holder.h" #include "mongo/db/client.h" diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index a0823458812..2f89aa3354e 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -35,7 +35,6 @@ #include "mongo/base/init.h" #include "mongo/base/initializer.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager_global.h" #include "mongo/db/catalog/index_create.h" diff --git a/src/mongo/dbtests/executor_registry.cpp b/src/mongo/dbtests/executor_registry.cpp index 02686dd2c26..c8c90aa5374 100644 --- a/src/mongo/dbtests/executor_registry.cpp +++ b/src/mongo/dbtests/executor_registry.cpp @@ -33,7 +33,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" diff --git a/src/mongo/dbtests/logical_sessions_tests.cpp b/src/mongo/dbtests/logical_sessions_tests.cpp index 464491405cd..07b3f892531 100644 --- a/src/mongo/dbtests/logical_sessions_tests.cpp +++ b/src/mongo/dbtests/logical_sessions_tests.cpp @@ -30,7 +30,6 @@ #include <memory> -#include "mongo/client/dbclientinterface.h" #include "mongo/client/index_spec.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/logical_session_id.h" diff --git a/src/mongo/dbtests/mock/mock_conn_registry.h b/src/mongo/dbtests/mock/mock_conn_registry.h index 7f4a7b849da..853f386d980 100644 --- a/src/mongo/dbtests/mock/mock_conn_registry.h +++ b/src/mongo/dbtests/mock/mock_conn_registry.h @@ -29,7 +29,6 @@ #pragma once #include "mongo/base/status.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/dbtests/mock/mock_dbclient_connection.h" #include "mongo/dbtests/mock/mock_remote_db_server.h" #include "mongo/stdx/unordered_map.h" diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h index 04af61ee55f..bcecd30d37f 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.h +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h @@ -30,7 +30,7 @@ #include <string> #include <vector> -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/dbtests/mock/mock_remote_db_server.h" namespace mongo { @@ -73,15 +73,15 @@ public: int nToSkip = 0, const mongo::BSONObj* fieldsToReturn = 0, int queryOptions = 0, - int batchSize = 0); + int batchSize = 0) override; - uint64_t getSockCreationMicroSec() const; + uint64_t getSockCreationMicroSec() const override; - virtual void insert(const std::string& ns, BSONObj obj, int flags = 0); + void insert(const std::string& ns, BSONObj obj, int flags = 0) override; - virtual void insert(const std::string& ns, const std::vector<BSONObj>& objList, int flags = 0); + void insert(const std::string& ns, const std::vector<BSONObj>& objList, int flags = 0) override; - virtual void remove(const std::string& ns, Query query, int flags = 0); + void remove(const std::string& ns, Query query, int flags = 0) override; // // Getters @@ -89,7 +89,7 @@ public: mongo::ConnectionString::ConnectionType type() const; bool isFailed() const; - double getSoTimeout() const; + double getSoTimeout() const override; std::string getServerAddress() const; std::string toString() const; @@ -100,24 +100,24 @@ public: const std::string& ns, mongo::Query query, const mongo::BSONObj* fieldsToReturn = 0, - int queryOptions = 0); + int queryOptions = 0) override; unsigned long long query(stdx::function<void(mongo::DBClientCursorBatchIterator&)> f, const std::string& ns, mongo::Query query, const mongo::BSONObj* fieldsToReturn = 0, - int queryOptions = 0); + int queryOptions = 0) override; // // Unsupported methods (these are pure virtuals in the base class) // - void killCursor(const NamespaceString& ns, long long cursorID); + void killCursor(const NamespaceString& ns, long long cursorID) override; bool call(mongo::Message& toSend, mongo::Message& response, bool assertOk, - std::string* actualServer); - void say(mongo::Message& toSend, bool isRetry = false, std::string* actualServer = 0); + std::string* actualServer) override; + void say(mongo::Message& toSend, bool isRetry = false, std::string* actualServer = 0) override; bool lazySupported() const; private: diff --git a/src/mongo/dbtests/mock/mock_dbclient_cursor.h b/src/mongo/dbtests/mock/mock_dbclient_cursor.h index 762bd77b7c2..2a0561c781b 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_cursor.h +++ b/src/mongo/dbtests/mock/mock_dbclient_cursor.h @@ -30,8 +30,8 @@ #pragma once -#include "mongo/client/dbclientcursor.h" -#include "mongo/client/dbclientmockcursor.h" +#include "mongo/client/dbclient_cursor.h" +#include "mongo/client/dbclient_mockcursor.h" namespace mongo { diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.h b/src/mongo/dbtests/mock/mock_remote_db_server.h index e17f69bfd63..3c147220668 100644 --- a/src/mongo/dbtests/mock/mock_remote_db_server.h +++ b/src/mongo/dbtests/mock/mock_remote_db_server.h @@ -30,7 +30,8 @@ #include <string> #include <vector> -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/connection_string.h" +#include "mongo/client/query.h" #include "mongo/db/jsobj.h" #include "mongo/rpc/unique_message.h" #include "mongo/stdx/unordered_map.h" diff --git a/src/mongo/dbtests/mock_dbclient_conn_test.cpp b/src/mongo/dbtests/mock_dbclient_conn_test.cpp index 5c02d561541..cc90aa3586a 100644 --- a/src/mongo/dbtests/mock_dbclient_conn_test.cpp +++ b/src/mongo/dbtests/mock_dbclient_conn_test.cpp @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/jsobj.h" #include "mongo/dbtests/mock/mock_dbclient_connection.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/dbtests/mock_replica_set_test.cpp b/src/mongo/dbtests/mock_replica_set_test.cpp index 999e8bc631d..548a69b0ab7 100644 --- a/src/mongo/dbtests/mock_replica_set_test.cpp +++ b/src/mongo/dbtests/mock_replica_set_test.cpp @@ -27,7 +27,6 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/dbtests/mock/mock_dbclient_connection.h" #include "mongo/dbtests/mock/mock_replica_set.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp index a2467126c1a..01d7b6af527 100644 --- a/src/mongo/dbtests/plan_ranking.cpp +++ b/src/mongo/dbtests/plan_ranking.cpp @@ -34,7 +34,7 @@ #include <iostream> -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp index ea845004d55..d18346cb21b 100644 --- a/src/mongo/dbtests/query_stage_and.cpp +++ b/src/mongo/dbtests/query_stage_and.cpp @@ -34,7 +34,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp index f13b997bdb5..5b071ba838c 100644 --- a/src/mongo/dbtests/query_stage_collscan.cpp +++ b/src/mongo/dbtests/query_stage_collscan.cpp @@ -32,7 +32,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" diff --git a/src/mongo/dbtests/query_stage_count_scan.cpp b/src/mongo/dbtests/query_stage_count_scan.cpp index 7e243068ae6..dbddae9b3b3 100644 --- a/src/mongo/dbtests/query_stage_count_scan.cpp +++ b/src/mongo/dbtests/query_stage_count_scan.cpp @@ -29,7 +29,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" diff --git a/src/mongo/dbtests/query_stage_distinct.cpp b/src/mongo/dbtests/query_stage_distinct.cpp index 6f9b2a5b5cd..1fb9aad1350 100644 --- a/src/mongo/dbtests/query_stage_distinct.cpp +++ b/src/mongo/dbtests/query_stage_distinct.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp index 3ddf6b6e630..a2a77702e19 100644 --- a/src/mongo/dbtests/query_stage_fetch.cpp +++ b/src/mongo/dbtests/query_stage_fetch.cpp @@ -32,7 +32,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" diff --git a/src/mongo/dbtests/query_stage_ixscan.cpp b/src/mongo/dbtests/query_stage_ixscan.cpp index 0e67b949c94..9449da1e3b0 100644 --- a/src/mongo/dbtests/query_stage_ixscan.cpp +++ b/src/mongo/dbtests/query_stage_ixscan.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/client.h" #include "mongo/db/db_raii.h" diff --git a/src/mongo/dbtests/query_stage_keep.cpp b/src/mongo/dbtests/query_stage_keep.cpp index 5a40ec12cc4..76ca9a0f78c 100644 --- a/src/mongo/dbtests/query_stage_keep.cpp +++ b/src/mongo/dbtests/query_stage_keep.cpp @@ -32,7 +32,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" diff --git a/src/mongo/dbtests/query_stage_limit_skip.cpp b/src/mongo/dbtests/query_stage_limit_skip.cpp index 103f5932255..c38dc215116 100644 --- a/src/mongo/dbtests/query_stage_limit_skip.cpp +++ b/src/mongo/dbtests/query_stage_limit_skip.cpp @@ -33,7 +33,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/client.h" #include "mongo/db/exec/limit.h" #include "mongo/db/exec/plan_stage.h" diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp index 44708b006b3..59308a05fa5 100644 --- a/src/mongo/dbtests/query_stage_merge_sort.cpp +++ b/src/mongo/dbtests/query_stage_merge_sort.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp index cfa651d2ed9..9ff58f996cd 100644 --- a/src/mongo/dbtests/query_stage_sort.cpp +++ b/src/mongo/dbtests/query_stage_sort.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" diff --git a/src/mongo/dbtests/query_stage_tests.cpp b/src/mongo/dbtests/query_stage_tests.cpp index 002a213791b..396b476df8c 100644 --- a/src/mongo/dbtests/query_stage_tests.cpp +++ b/src/mongo/dbtests/query_stage_tests.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index d954cf9d727..8e073b3d0b6 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -31,7 +31,7 @@ #include <boost/optional.hpp> #include <iostream> -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/client.h" #include "mongo/db/clientcursor.h" diff --git a/src/mongo/dbtests/replica_set_monitor_test.cpp b/src/mongo/dbtests/replica_set_monitor_test.cpp index 0666822dc42..daddf00ce5e 100644 --- a/src/mongo/dbtests/replica_set_monitor_test.cpp +++ b/src/mongo/dbtests/replica_set_monitor_test.cpp @@ -33,7 +33,6 @@ #include "mongo/client/connpool.h" #include "mongo/client/dbclient_rs.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/replica_set_monitor.h" #include "mongo/client/replica_set_monitor_internal.h" #include "mongo/dbtests/mock/mock_conn_registry.h" diff --git a/src/mongo/dbtests/updatetests.cpp b/src/mongo/dbtests/updatetests.cpp index 7b62f5ad4a0..fa2a8ca8b2e 100644 --- a/src/mongo/dbtests/updatetests.cpp +++ b/src/mongo/dbtests/updatetests.cpp @@ -34,7 +34,7 @@ #include <iostream> #include "mongo/bson/mutable/mutable_bson_test_utils.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/client.h" #include "mongo/db/db.h" diff --git a/src/mongo/rpc/legacy_request.cpp b/src/mongo/rpc/legacy_request.cpp index 1bbd56e8414..aec6d5b4066 100644 --- a/src/mongo/rpc/legacy_request.cpp +++ b/src/mongo/rpc/legacy_request.cpp @@ -30,8 +30,8 @@ #include <utility> -#include "mongo/client/dbclientinterface.h" #include "mongo/db/dbmessage.h" +#include "mongo/db/namespace_string.h" #include "mongo/rpc/legacy_request.h" #include "mongo/rpc/metadata.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/rpc/legacy_request_builder.cpp b/src/mongo/rpc/legacy_request_builder.cpp index d7978ef65a7..caeb752acbb 100644 --- a/src/mongo/rpc/legacy_request_builder.cpp +++ b/src/mongo/rpc/legacy_request_builder.cpp @@ -33,8 +33,8 @@ #include <tuple> #include <utility> -#include "mongo/client/dbclientinterface.h" #include "mongo/client/read_preference.h" +#include "mongo/db/dbmessage.h" #include "mongo/db/namespace_string.h" #include "mongo/rpc/message.h" #include "mongo/rpc/metadata.h" diff --git a/src/mongo/rpc/legacy_request_test.cpp b/src/mongo/rpc/legacy_request_test.cpp index 2e8cacf28a3..52d6329408d 100644 --- a/src/mongo/rpc/legacy_request_test.cpp +++ b/src/mongo/rpc/legacy_request_test.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/bson/json.h" #include "mongo/db/dbmessage.h" #include "mongo/db/jsobj.h" #include "mongo/rpc/legacy_request.h" diff --git a/src/mongo/rpc/metadata.cpp b/src/mongo/rpc/metadata.cpp index 6fd398a466f..8c88cb23717 100644 --- a/src/mongo/rpc/metadata.cpp +++ b/src/mongo/rpc/metadata.cpp @@ -30,7 +30,8 @@ #include "mongo/rpc/metadata.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/read_preference.h" +#include "mongo/db/dbmessage.h" #include "mongo/db/jsobj.h" #include "mongo/db/logical_clock.h" #include "mongo/db/logical_time_validator.h" diff --git a/src/mongo/rpc/metadata_test.cpp b/src/mongo/rpc/metadata_test.cpp index 7524045b1b4..cb8bb54579a 100644 --- a/src/mongo/rpc/metadata_test.cpp +++ b/src/mongo/rpc/metadata_test.cpp @@ -30,7 +30,8 @@ #include <utility> -#include "mongo/client/dbclientinterface.h" +#include "mongo/bson/json.h" +#include "mongo/db/dbmessage.h" #include "mongo/db/jsobj.h" #include "mongo/rpc/metadata.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/rpc/op_msg_integration_test.cpp b/src/mongo/rpc/op_msg_integration_test.cpp index 6dd9fec7f2f..ab69b57b206 100644 --- a/src/mongo/rpc/op_msg_integration_test.cpp +++ b/src/mongo/rpc/op_msg_integration_test.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/op_msg.h" #include "mongo/unittest/integration_test.h" diff --git a/src/mongo/s/client/parallel.cpp b/src/mongo/s/client/parallel.cpp index 62d9425ba35..e291f37a80d 100644 --- a/src/mongo/s/client/parallel.cpp +++ b/src/mongo/s/client/parallel.cpp @@ -33,8 +33,8 @@ #include "mongo/s/client/parallel.h" #include "mongo/client/constants.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/client/dbclient_rs.h" -#include "mongo/client/dbclientcursor.h" #include "mongo/client/replica_set_monitor.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/query/query_request.h" diff --git a/src/mongo/s/client/parallel.h b/src/mongo/s/client/parallel.h index 93b1902fe85..4e740c93c39 100644 --- a/src/mongo/s/client/parallel.h +++ b/src/mongo/s/client/parallel.h @@ -30,8 +30,8 @@ #include <set> #include <string> -#include "mongo/client/dbclientinterface.h" #include "mongo/client/query.h" +#include "mongo/client/query_spec.h" #include "mongo/db/namespace_string.h" #include "mongo/s/client/shard.h" #include "mongo/s/stale_exception.h" diff --git a/src/mongo/s/client/version_manager.cpp b/src/mongo/s/client/version_manager.cpp index f63d199607c..0d9e4ee897f 100644 --- a/src/mongo/s/client/version_manager.cpp +++ b/src/mongo/s/client/version_manager.cpp @@ -32,6 +32,7 @@ #include "mongo/s/client/version_manager.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/client/dbclient_rs.h" #include "mongo/db/namespace_string.h" #include "mongo/s/catalog_cache.h" diff --git a/src/mongo/s/commands/cluster_available_query_options_cmd.cpp b/src/mongo/s/commands/cluster_available_query_options_cmd.cpp index 73e333e9396..38580436bfa 100644 --- a/src/mongo/s/commands/cluster_available_query_options_cmd.cpp +++ b/src/mongo/s/commands/cluster_available_query_options_cmd.cpp @@ -29,7 +29,6 @@ #include "mongo/platform/basic.h" #include "mongo/base/status.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/commands.h" namespace mongo { diff --git a/src/mongo/s/commands/cluster_explain_cmd.cpp b/src/mongo/s/commands/cluster_explain_cmd.cpp index f5e49fdb401..ff7fc38f7be 100644 --- a/src/mongo/s/commands/cluster_explain_cmd.cpp +++ b/src/mongo/s/commands/cluster_explain_cmd.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/command_generic_argument.h" #include "mongo/db/commands.h" #include "mongo/db/query/explain.h" diff --git a/src/mongo/s/commands/cluster_kill_op.cpp b/src/mongo/s/commands/cluster_kill_op.cpp index 232380d5dfc..8ba9d2bff3c 100644 --- a/src/mongo/s/commands/cluster_kill_op.cpp +++ b/src/mongo/s/commands/cluster_kill_op.cpp @@ -37,7 +37,6 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/bson/util/bson_extract.h" #include "mongo/client/connpool.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/db/audit.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" diff --git a/src/mongo/s/commands/cluster_user_management_commands.cpp b/src/mongo/s/commands/cluster_user_management_commands.cpp index f899393c2f5..76c34c7d63c 100644 --- a/src/mongo/s/commands/cluster_user_management_commands.cpp +++ b/src/mongo/s/commands/cluster_user_management_commands.cpp @@ -32,7 +32,6 @@ #include "mongo/base/status.h" #include "mongo/bson/mutable/document.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/config.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager_global.h" diff --git a/src/mongo/s/write_ops/cluster_write.cpp b/src/mongo/s/write_ops/cluster_write.cpp index b82c6c3f88a..0f0772d7ec3 100644 --- a/src/mongo/s/write_ops/cluster_write.cpp +++ b/src/mongo/s/write_ops/cluster_write.cpp @@ -36,6 +36,7 @@ #include "mongo/base/status.h" #include "mongo/client/connpool.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/lasterror.h" #include "mongo/db/write_concern_options.h" #include "mongo/s/balancer_configuration.h" diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp index 744b511ebb9..cd5e5bcd767 100644 --- a/src/mongo/scripting/engine.cpp +++ b/src/mongo/scripting/engine.cpp @@ -34,8 +34,8 @@ #include <boost/filesystem/operations.hpp> #include <cctype> -#include "mongo/client/dbclientcursor.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" #include "mongo/scripting/dbdirectclient_factory.h" diff --git a/src/mongo/scripting/mozjs/cursor.h b/src/mongo/scripting/mozjs/cursor.h index a0190e6a359..bb241b3df36 100644 --- a/src/mongo/scripting/mozjs/cursor.h +++ b/src/mongo/scripting/mozjs/cursor.h @@ -28,8 +28,7 @@ #pragma once -#include "mongo/client/dbclientcursor.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/scripting/mozjs/wraptype.h" namespace mongo { diff --git a/src/mongo/scripting/mozjs/cursor_handle.cpp b/src/mongo/scripting/mozjs/cursor_handle.cpp index 181e93f51dd..21857804acc 100644 --- a/src/mongo/scripting/mozjs/cursor_handle.cpp +++ b/src/mongo/scripting/mozjs/cursor_handle.cpp @@ -30,8 +30,8 @@ #include "mongo/platform/basic.h" +#include "mongo/client/dbclient_base.h" #include "mongo/scripting/mozjs/cursor_handle.h" - #include "mongo/scripting/mozjs/implscope.h" #include "mongo/scripting/mozjs/wrapconstrainedmethod.h" #include "mongo/util/log.h" diff --git a/src/mongo/scripting/mozjs/cursor_handle.h b/src/mongo/scripting/mozjs/cursor_handle.h index 2326c57edcc..fda87e8b691 100644 --- a/src/mongo/scripting/mozjs/cursor_handle.h +++ b/src/mongo/scripting/mozjs/cursor_handle.h @@ -28,8 +28,7 @@ #pragma once -#include "mongo/client/dbclientcursor.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/scripting/mozjs/wraptype.h" namespace mongo { diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h index 4a8dcba9aef..72fe9db3f72 100644 --- a/src/mongo/scripting/mozjs/implscope.h +++ b/src/mongo/scripting/mozjs/implscope.h @@ -31,7 +31,7 @@ #include <jsapi.h> #include <vm/PosixNSPR.h> -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/scripting/mozjs/bindata.h" #include "mongo/scripting/mozjs/bson.h" #include "mongo/scripting/mozjs/code.h" diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp index 7c8f848a408..aa08c2a4ad8 100644 --- a/src/mongo/scripting/mozjs/mongo.cpp +++ b/src/mongo/scripting/mozjs/mongo.cpp @@ -31,8 +31,8 @@ #include "mongo/scripting/mozjs/mongo.h" #include "mongo/bson/simple_bsonelement_comparator.h" +#include "mongo/client/dbclient_base.h" #include "mongo/client/dbclient_rs.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/global_conn_pool.h" #include "mongo/client/mongo_uri.h" #include "mongo/client/native_sasl_client_session.h" diff --git a/src/mongo/scripting/mozjs/proxyscope.h b/src/mongo/scripting/mozjs/proxyscope.h index 1e3fe69999b..0b936de20ed 100644 --- a/src/mongo/scripting/mozjs/proxyscope.h +++ b/src/mongo/scripting/mozjs/proxyscope.h @@ -30,7 +30,7 @@ #include "vm/PosixNSPR.h" -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/scripting/mozjs/engine.h" #include "mongo/stdx/condition_variable.h" #include "mongo/stdx/functional.h" diff --git a/src/mongo/scripting/mozjs/session.h b/src/mongo/scripting/mozjs/session.h index b003b812415..3b8bd8a10f4 100644 --- a/src/mongo/scripting/mozjs/session.h +++ b/src/mongo/scripting/mozjs/session.h @@ -28,7 +28,7 @@ #pragma once -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/scripting/mozjs/wraptype.h" namespace mongo { diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp index c188680d230..8e1f6e555fc 100644 --- a/src/mongo/shell/bench.cpp +++ b/src/mongo/shell/bench.cpp @@ -34,7 +34,7 @@ #include <pcrecpp.h> -#include "mongo/client/dbclientcursor.h" +#include "mongo/client/dbclient_cursor.h" #include "mongo/db/namespace_string.h" #include "mongo/db/query/cursor_response.h" #include "mongo/db/query/getmore_request.h" diff --git a/src/mongo/shell/bench.h b/src/mongo/shell/bench.h index 951b6b251b1..136e6825c2e 100644 --- a/src/mongo/shell/bench.h +++ b/src/mongo/shell/bench.h @@ -31,7 +31,7 @@ #include <boost/optional.hpp> #include <string> -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/db/jsobj.h" #include "mongo/platform/atomic_word.h" #include "mongo/stdx/condition_variable.h" diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp index 5e24c905c4f..94b68ee43e3 100644 --- a/src/mongo/shell/dbshell.cpp +++ b/src/mongo/shell/dbshell.cpp @@ -41,7 +41,6 @@ #include "mongo/base/init.h" #include "mongo/base/initializer.h" #include "mongo/base/status.h" -#include "mongo/client/dbclientinterface.h" #include "mongo/client/mongo_uri.h" #include "mongo/db/auth/sasl_command_constants.h" #include "mongo/db/client.h" diff --git a/src/mongo/shell/shell_utils.cpp b/src/mongo/shell/shell_utils.cpp index 50bd8a8ba80..0d4b118dc70 100644 --- a/src/mongo/shell/shell_utils.cpp +++ b/src/mongo/shell/shell_utils.cpp @@ -32,7 +32,7 @@ #include "mongo/shell/shell_utils.h" -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_base.h" #include "mongo/client/replica_set_monitor.h" #include "mongo/db/hasher.h" #include "mongo/platform/random.h" diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp index f37f4b6964c..8b0f1075caa 100644 --- a/src/mongo/shell/shell_utils_launcher.cpp +++ b/src/mongo/shell/shell_utils_launcher.cpp @@ -58,7 +58,7 @@ #include <unistd.h> #endif -#include "mongo/client/dbclientinterface.h" +#include "mongo/client/dbclient_connection.h" #include "mongo/scripting/engine.h" #include "mongo/shell/shell_utils.h" #include "mongo/stdx/memory.h" |