diff --git a/modules_poc/modules.yaml b/modules_poc/modules.yaml index 66cffe11fc2..5dd9a2f0a0a 100644 --- a/modules_poc/modules.yaml +++ b/modules_poc/modules.yaml @@ -421,6 +421,9 @@ access_control: slack: server-security jira: Server Security files: + - src/mongo/client/native_sasl_client_session* + - src/mongo/client/sasl_* + - src/mongo/client/scram_client_cache* - src/mongo/db/auth/ - src/mongo/db/commands/authentication* - src/mongo/db/commands/user_management* @@ -666,6 +669,8 @@ networking: meta: slack: server-networking-observability jira: Networking & Observability + # TODO SERVER-113765: uncomment the following line. + # fully_marked: true files: - src/mongo/client/ - src/mongo/dbtests/clienttests.cpp diff --git a/src/mongo/client/async_remote_command_targeter_adapter.h b/src/mongo/client/async_remote_command_targeter_adapter.h index 5ba712bca19..df05f9e63de 100644 --- a/src/mongo/client/async_remote_command_targeter_adapter.h +++ b/src/mongo/client/async_remote_command_targeter_adapter.h @@ -36,6 +36,7 @@ #include "mongo/util/assert_util.h" #include "mongo/util/cancellation.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -46,7 +47,7 @@ #include namespace mongo { -namespace async_rpc { +namespace MONGO_MOD_PUBLIC async_rpc { /** * This class serves as an adaptor that allows a mongo::RemoteCommandTargeter @@ -75,5 +76,5 @@ private: std::shared_ptr _targeter; }; -} // namespace async_rpc +} // namespace MONGO_MOD_PUBLIC async_rpc } // namespace mongo diff --git a/src/mongo/client/authenticate.h b/src/mongo/client/authenticate.h index 1e33b7e6d84..118c9f0f3a1 100644 --- a/src/mongo/client/authenticate.h +++ b/src/mongo/client/authenticate.h @@ -41,6 +41,7 @@ #include "mongo/executor/remote_command_response.h" #include "mongo/rpc/op_msg.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -55,7 +56,7 @@ namespace mongo { class BSONObj; -namespace auth { +namespace MONGO_MOD_PUBLIC auth { using RunCommandHook = std::function(OpMsgRequest request)>; @@ -211,5 +212,5 @@ SpeculativeAuthType speculateInternalAuth(const HostAndPort& remoteHost, BSONObjBuilder* helloRequestBuilder, std::shared_ptr* saslClientSession); -} // namespace auth +} // namespace MONGO_MOD_PUBLIC auth } // namespace mongo diff --git a/src/mongo/client/backoff_with_jitter.h b/src/mongo/client/backoff_with_jitter.h index 48f749b6e89..fc393d0cfe9 100644 --- a/src/mongo/client/backoff_with_jitter.h +++ b/src/mongo/client/backoff_with_jitter.h @@ -31,10 +31,11 @@ #include "mongo/platform/random.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { /** * Generic implementation of a retry with full jitter and exponential backoff. @@ -87,4 +88,4 @@ private: static XorShift128& _randomEngine(); }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/client_api_version_parameters.idl b/src/mongo/client/client_api_version_parameters.idl index 5e17c9e3440..31c3bd75c12 100644 --- a/src/mongo/client/client_api_version_parameters.idl +++ b/src/mongo/client/client_api_version_parameters.idl @@ -38,6 +38,7 @@ structs: ClientAPIVersionParameters: description: "Parser for Stable API parameters passed to 'new Mongo()' in the mongo shell" strict: true + mod_visibility: public fields: version: description: "The requested API version" diff --git a/src/mongo/client/client_transient_tls_parameters.idl b/src/mongo/client/client_transient_tls_parameters.idl index 9a4e3f46fcc..4e6509b33d3 100644 --- a/src/mongo/client/client_transient_tls_parameters.idl +++ b/src/mongo/client/client_transient_tls_parameters.idl @@ -36,6 +36,7 @@ structs: ClientTLSParameters: description: "Parser for TLS parameters passed to 'new Mongo()' in jstests" strict: true + mod_visibility: public fields: certificateKeyFile: description: "PEM certificate/key file for TLS" diff --git a/src/mongo/client/connection_string.h b/src/mongo/client/connection_string.h index 94e1bb0fad0..25e2ced2328 100644 --- a/src/mongo/client/connection_string.h +++ b/src/mongo/client/connection_string.h @@ -35,6 +35,7 @@ #include "mongo/bson/util/builder_fwd.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -64,7 +65,7 @@ class TransientSSLParams; * std::string errmsg; * DBClientBase * conn = cs.connect( errmsg ); */ -class ConnectionString { +class MONGO_MOD_PUBLIC ConnectionString { public: enum class ConnectionType { kInvalid = 0, kStandalone, kReplicaSet, kCustom, kLocal }; diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h index 3d94c8da65b..8075e23b92f 100644 --- a/src/mongo/client/connpool.h +++ b/src/mongo/client/connpool.h @@ -40,6 +40,7 @@ #include "mongo/util/background.h" #include "mongo/util/duration.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/time_support.h" #include @@ -53,7 +54,7 @@ #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { class BSONObjBuilder; @@ -285,9 +286,9 @@ private: AtomicWord _inShutdown; }; -class DBConnectionHook { +class MONGO_MOD_OPEN DBConnectionHook { public: - virtual ~DBConnectionHook() {} + virtual ~DBConnectionHook() = default; virtual void onCreate(DBClientBase* conn) {} virtual void onHandedOut(DBClientBase* conn) {} virtual void onRelease(DBClientBase* conn) {} @@ -377,7 +378,8 @@ public: * Gets the time it took for the last connection to be established from the PoolMap given a host * and timeout. */ - Milliseconds getPoolHostConnTime_forTest(const std::string& host, double timeout) const; + MONGO_MOD_PUBLIC Milliseconds getPoolHostConnTime_forTest(const std::string& host, + double timeout) const; /** * Gets the number of connections available in the pool. @@ -573,4 +575,4 @@ private: const double _socketTimeoutSecs; }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h index fec3acedf4f..1b37a39f142 100644 --- a/src/mongo/client/dbclient_base.h +++ b/src/mongo/client/dbclient_base.h @@ -59,6 +59,7 @@ #include "mongo/transport/message_compressor_manager.h" #include "mongo/transport/session.h" #include "mongo/util/assert_util.h" +#include "mongo/util/modules.h" #include "mongo/util/net/ssl_types.h" #include "mongo/util/str.h" @@ -75,7 +76,7 @@ #include #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { namespace executor { struct RemoteCommandResponse; @@ -103,7 +104,7 @@ enum class ExhaustMode { kOn, kOff }; /** * Abstract class that implements the core db operations. */ -class DBClientBase { +class MONGO_MOD_OPEN DBClientBase { DBClientBase(const DBClientBase&) = delete; DBClientBase& operator=(const DBClientBase&) = delete; @@ -797,4 +798,4 @@ private: rpc::ReplyMetadataReader _oldReader; }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h index ec84409ecef..2c611a3f3d4 100644 --- a/src/mongo/client/dbclient_connection.h +++ b/src/mongo/client/dbclient_connection.h @@ -47,6 +47,7 @@ #include "mongo/transport/session.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/net/ssl_options.h" #include "mongo/util/net/ssl_types.h" @@ -73,7 +74,7 @@ class DBClientCursor; * A basic connection to the database. * This is the main entry point for talking to a simple Mongo setup */ -class DBClientConnection : public DBClientSession { +class MONGO_MOD_OPEN DBClientConnection : public DBClientSession { public: DBClientConnection(bool autoReconnect = false, double soTimeout = 0, diff --git a/src/mongo/client/dbclient_cursor.h b/src/mongo/client/dbclient_cursor.h index 06f48810a43..5247e4c26a3 100644 --- a/src/mongo/client/dbclient_cursor.h +++ b/src/mongo/client/dbclient_cursor.h @@ -41,6 +41,7 @@ #include "mongo/rpc/message.h" #include "mongo/util/assert_util.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include #include @@ -70,7 +71,7 @@ class AggregateCommandRequest; * - The last command (find, aggregate or getMore) returned an error that indicated the cursor is no * longer open on the server side. */ -class DBClientCursor { +class MONGO_MOD_PUBLIC DBClientCursor { DBClientCursor(const DBClientCursor&) = delete; DBClientCursor& operator=(const DBClientCursor&) = delete; diff --git a/src/mongo/client/dbclient_mockcursor.h b/src/mongo/client/dbclient_mockcursor.h index b0730978522..71a75a9cf4d 100644 --- a/src/mongo/client/dbclient_mockcursor.h +++ b/src/mongo/client/dbclient_mockcursor.h @@ -31,13 +31,14 @@ #include "mongo/bson/bsonobj.h" #include "mongo/client/dbclient_cursor.h" +#include "mongo/util/modules.h" #include #include namespace mongo { -class DBClientMockCursor : public DBClientCursor { +class MONGO_MOD_PUBLIC DBClientMockCursor : public DBClientCursor { public: DBClientMockCursor(mongo::DBClientBase* client, const BSONArray& mockCollection, diff --git a/src/mongo/client/dbclient_rs.h b/src/mongo/client/dbclient_rs.h index e1ddb5cb8eb..908788e768e 100644 --- a/src/mongo/client/dbclient_rs.h +++ b/src/mongo/client/dbclient_rs.h @@ -51,6 +51,7 @@ #include "mongo/rpc/metadata.h" #include "mongo/rpc/op_msg.h" #include "mongo/rpc/unique_message.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/net/ssl_types.h" @@ -79,7 +80,7 @@ typedef std::shared_ptr ReplicaSetMonitorPtr; On a failover situation, expect at least one operation to return an error (throw an exception) before the failover is complete. Operations are not retried. */ -class DBClientReplicaSet : public DBClientBase { +class MONGO_MOD_PUBLIC DBClientReplicaSet : public DBClientBase { public: using DBClientBase::find; diff --git a/src/mongo/client/dbclient_session.h b/src/mongo/client/dbclient_session.h index f42897a5b05..0dcccb692ef 100644 --- a/src/mongo/client/dbclient_session.h +++ b/src/mongo/client/dbclient_session.h @@ -56,6 +56,7 @@ #include "mongo/transport/transport_layer.h" #include "mongo/util/duration.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/net/socket_exception.h" #include "mongo/util/net/ssl_options.h" @@ -90,7 +91,7 @@ class DBClientCursor; * exception, it is legal to call shutdown() or shutdownAndDisallowReconnect() from any thread as a * way to interrupt the owning thread. */ -class DBClientSession : public DBClientBase { +class MONGO_MOD_PUBLIC DBClientSession : public DBClientBase { public: /** * A hook used to validate the reply of a "hello" command during connection. If the hook diff --git a/src/mongo/client/fetcher.h b/src/mongo/client/fetcher.h index c87337d821d..d8e49f37330 100644 --- a/src/mongo/client/fetcher.h +++ b/src/mongo/client/fetcher.h @@ -49,6 +49,7 @@ #include "mongo/util/future.h" #include "mongo/util/future_impl.h" #include "mongo/util/interruptible.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -62,7 +63,7 @@ #include #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { class Fetcher { Fetcher(const Fetcher&) = delete; @@ -311,4 +312,4 @@ private: */ std::ostream& operator<<(std::ostream& os, const Fetcher::State& state); -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/global_conn_pool.h b/src/mongo/client/global_conn_pool.h index 40124d608dd..fd0ab17170b 100644 --- a/src/mongo/client/global_conn_pool.h +++ b/src/mongo/client/global_conn_pool.h @@ -31,12 +31,13 @@ #include "mongo/client/connpool.h" #include "mongo/client/replica_set_monitor_manager.h" +#include "mongo/util/modules.h" -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { /** * Global connection pool (used by all references to the internal DB client). */ extern DBConnectionPool globalConnPool; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/index_spec.h b/src/mongo/client/index_spec.h index 8a4df1c19d9..3da21fcff45 100644 --- a/src/mongo/client/index_spec.h +++ b/src/mongo/client/index_spec.h @@ -33,6 +33,7 @@ #include "mongo/bson/bsonelement.h" #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" +#include "mongo/util/modules.h" #include #include @@ -42,7 +43,7 @@ namespace mongo { class StringData; -class IndexSpec { +class MONGO_MOD_PUBLIC IndexSpec { public: // An enumeration of symbolic names for index types. enum IndexType { diff --git a/src/mongo/client/internal_auth.h b/src/mongo/client/internal_auth.h index d85b16f6598..947e5c308e1 100644 --- a/src/mongo/client/internal_auth.h +++ b/src/mongo/client/internal_auth.h @@ -31,6 +31,7 @@ #include "mongo/base/string_data.h" #include "mongo/bson/bsonobj.h" +#include "mongo/util/modules.h" #include #include @@ -45,7 +46,7 @@ namespace mongo { class BSONObj; -namespace auth { +namespace MONGO_MOD_PUBLIC auth { /** * Sets the keys used by authenticateInternalClient - these should be a vector of raw passwords, @@ -85,5 +86,5 @@ BSONObj getInternalAuthParams(size_t idx, StringData mechanism); */ BSONObj createInternalX509AuthDocument(boost::optional userName = boost::none); -} // namespace auth +} // namespace MONGO_MOD_PUBLIC auth } // namespace mongo diff --git a/src/mongo/client/mongo_shell_options.idl b/src/mongo/client/mongo_shell_options.idl index 3c40e2f1fc0..29bc3ffe9da 100644 --- a/src/mongo/client/mongo_shell_options.idl +++ b/src/mongo/client/mongo_shell_options.idl @@ -37,6 +37,7 @@ imports: structs: MongoShellOptions: description: "The third argument to `new Mongo(...)`" + mod_visibility: public fields: api: description: "API strict version parameter" diff --git a/src/mongo/client/mongo_uri.h b/src/mongo/client/mongo_uri.h index b12ca9df940..b9a66981b3f 100644 --- a/src/mongo/client/mongo_uri.h +++ b/src/mongo/client/mongo_uri.h @@ -37,6 +37,7 @@ #include "mongo/client/connection_string.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/assert_util.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -51,7 +52,7 @@ #include #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { class ClientAPIVersionParameters; @@ -368,4 +369,4 @@ inline std::ostream& operator<<(std::ostream& ss, const MongoURI& uri) { inline StringBuilder& operator<<(StringBuilder& sb, const MongoURI& uri) { return sb << uri._connectString; } -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/read_preference.h b/src/mongo/client/read_preference.h index e7dd9d874a2..c883fb6bb72 100644 --- a/src/mongo/client/read_preference.h +++ b/src/mongo/client/read_preference.h @@ -41,6 +41,7 @@ #include "mongo/db/operation_context.h" #include "mongo/db/tenant_id.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include @@ -48,7 +49,7 @@ #include #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { template class StatusWith; @@ -283,4 +284,4 @@ private: bool _usedDefaultReadPrefValue = false; }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/read_preference.idl b/src/mongo/client/read_preference.idl index 7f329ea2c7e..b43e2489665 100644 --- a/src/mongo/client/read_preference.idl +++ b/src/mongo/client/read_preference.idl @@ -39,6 +39,8 @@ enums: ReadPreference: description: Enumeration representing Read Preference Modes type: string + # TODO SERVER-113765: uncomment the following line. + # mod_visibility: public values: # Read from primary only. All operations produce an error (throw an exception where # applicable) if primary is unavailable. Cannot be combined with tags. diff --git a/src/mongo/client/read_preference_validators.h b/src/mongo/client/read_preference_validators.h index ac7a2b4969a..238b181ac05 100644 --- a/src/mongo/client/read_preference_validators.h +++ b/src/mongo/client/read_preference_validators.h @@ -30,11 +30,12 @@ #pragma once #include "mongo/base/status.h" +#include "mongo/util/modules.h" namespace mongo { -Status validateMaxStalenessSecondsExternal(std::int64_t maxStalenessSeconds, - const boost::optional& tenantId = boost::none); +MONGO_MOD_PUBLIC Status validateMaxStalenessSecondsExternal( + std::int64_t maxStalenessSeconds, const boost::optional& tenantId = boost::none); } // namespace mongo diff --git a/src/mongo/client/remote_command_retry_scheduler.h b/src/mongo/client/remote_command_retry_scheduler.h index b7938b840aa..8f13c3ea7bd 100644 --- a/src/mongo/client/remote_command_retry_scheduler.h +++ b/src/mongo/client/remote_command_retry_scheduler.h @@ -38,6 +38,7 @@ #include "mongo/stdx/mutex.h" #include "mongo/util/duration.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/time_support.h" #include @@ -159,6 +160,6 @@ private: CancellationSource _cancellationSource; }; -bool isMongosRetriableError(const ErrorCodes::Error& code); +MONGO_MOD_PUBLIC bool isMongosRetriableError(const ErrorCodes::Error& code); } // namespace mongo diff --git a/src/mongo/client/remote_command_targeter.h b/src/mongo/client/remote_command_targeter.h index 81841a1e00f..a175fad9bc5 100644 --- a/src/mongo/client/remote_command_targeter.h +++ b/src/mongo/client/remote_command_targeter.h @@ -34,6 +34,7 @@ #include "mongo/client/read_preference.h" #include "mongo/client/retry_strategy.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -42,7 +43,7 @@ namespace mongo { /** * Interface encapsulating the targeting logic for a given replica set or a standalone host. */ -class RemoteCommandTargeter { +class MONGO_MOD_PUBLIC RemoteCommandTargeter { RemoteCommandTargeter(const RemoteCommandTargeter&) = delete; RemoteCommandTargeter& operator=(const RemoteCommandTargeter&) = delete; diff --git a/src/mongo/client/remote_command_targeter_factory.h b/src/mongo/client/remote_command_targeter_factory.h index 4518b9abec4..d5988a719f7 100644 --- a/src/mongo/client/remote_command_targeter_factory.h +++ b/src/mongo/client/remote_command_targeter_factory.h @@ -30,6 +30,7 @@ #pragma once #include "mongo/client/remote_command_targeter.h" +#include "mongo/util/modules.h" namespace mongo { @@ -37,7 +38,7 @@ namespace mongo { * Constructs RemoteCommandTargeters based on the specific type of the target (standalone, * replica set, etc). */ -class RemoteCommandTargeterFactory { +class MONGO_MOD_PUBLIC RemoteCommandTargeterFactory { RemoteCommandTargeterFactory(const RemoteCommandTargeterFactory&) = delete; RemoteCommandTargeterFactory& operator=(const RemoteCommandTargeterFactory&) = delete; diff --git a/src/mongo/client/remote_command_targeter_factory_impl.h b/src/mongo/client/remote_command_targeter_factory_impl.h index 592d4a777ed..a7372127ca8 100644 --- a/src/mongo/client/remote_command_targeter_factory_impl.h +++ b/src/mongo/client/remote_command_targeter_factory_impl.h @@ -32,10 +32,11 @@ #include "mongo/client/connection_string.h" #include "mongo/client/remote_command_targeter.h" #include "mongo/client/remote_command_targeter_factory.h" +#include "mongo/util/modules.h" #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { /** * Targeter factory that instantiates remote command targeters based on the type of the @@ -51,4 +52,4 @@ public: std::unique_ptr create(const ConnectionString& connStr) override; }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/remote_command_targeter_factory_mock.h b/src/mongo/client/remote_command_targeter_factory_mock.h index 74cb5106a0e..0367b5950e0 100644 --- a/src/mongo/client/remote_command_targeter_factory_mock.h +++ b/src/mongo/client/remote_command_targeter_factory_mock.h @@ -33,6 +33,7 @@ #include "mongo/client/remote_command_targeter.h" #include "mongo/client/remote_command_targeter_factory.h" #include "mongo/client/remote_command_targeter_mock.h" +#include "mongo/util/modules.h" #include #include @@ -43,7 +44,8 @@ namespace mongo { * Factory which instantiates mock remote command targeters. This class is not thread-safe and is * only used for unit-testing. */ -class RemoteCommandTargeterFactoryMock final : public RemoteCommandTargeterFactory { +class MONGO_MOD_PUBLIC RemoteCommandTargeterFactoryMock final + : public RemoteCommandTargeterFactory { public: RemoteCommandTargeterFactoryMock(); ~RemoteCommandTargeterFactoryMock() override; diff --git a/src/mongo/client/remote_command_targeter_mock.h b/src/mongo/client/remote_command_targeter_mock.h index 8aac32fe8b1..a0d603b9815 100644 --- a/src/mongo/client/remote_command_targeter_mock.h +++ b/src/mongo/client/remote_command_targeter_mock.h @@ -38,6 +38,7 @@ #include "mongo/stdx/mutex.h" #include "mongo/util/cancellation.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -48,7 +49,7 @@ namespace mongo { -class RemoteCommandTargeterMock final : public RemoteCommandTargeter { +class MONGO_MOD_PUBLIC RemoteCommandTargeterMock final : public RemoteCommandTargeter { public: RemoteCommandTargeterMock(); ~RemoteCommandTargeterMock() override; diff --git a/src/mongo/client/replica_set_change_notifier.h b/src/mongo/client/replica_set_change_notifier.h index 4b8d3f5bec2..cb93d89c35c 100644 --- a/src/mongo/client/replica_set_change_notifier.h +++ b/src/mongo/client/replica_set_change_notifier.h @@ -35,6 +35,7 @@ #include "mongo/stdx/unordered_map.h" #include "mongo/util/functional.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -52,7 +53,7 @@ namespace mongo { /** * A stateful notifier for events from a set of ReplicaSetMonitors */ -class ReplicaSetChangeNotifier { +class MONGO_MOD_PUBLIC ReplicaSetChangeNotifier { public: using Key = std::string; class Listener; @@ -122,7 +123,7 @@ private: * if your implementation would block or seriously delay execution, * please schedule the majority of the work to complete asynchronously. */ -class ReplicaSetChangeNotifier::Listener { +class MONGO_MOD_OPEN ReplicaSetChangeNotifier::Listener { public: using Notifier = ReplicaSetChangeNotifier; using Key = typename Notifier::Key; diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h index 52a96bc4748..2c797b60bcd 100644 --- a/src/mongo/client/replica_set_monitor.h +++ b/src/mongo/client/replica_set_monitor.h @@ -36,6 +36,7 @@ #include "mongo/executor/task_executor.h" #include "mongo/util/concurrency/with_lock.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -51,7 +52,7 @@ namespace mongo { * A ReplicaSetMonitor holds a state about the replica set and provides a means to refresh the local * view. All methods perform the required synchronization to allow callers from multiple threads. */ -class ReplicaSetMonitor : public ReplicaSetMonitorInterface { +class MONGO_MOD_PUBLIC ReplicaSetMonitor : public ReplicaSetMonitorInterface { public: ~ReplicaSetMonitor() override; diff --git a/src/mongo/client/replica_set_monitor_interface.h b/src/mongo/client/replica_set_monitor_interface.h index 65928120d0d..70b49bbfed1 100644 --- a/src/mongo/client/replica_set_monitor_interface.h +++ b/src/mongo/client/replica_set_monitor_interface.h @@ -33,6 +33,7 @@ #include "mongo/client/replica_set_change_notifier.h" #include "mongo/util/cancellation.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -45,7 +46,7 @@ namespace mongo { struct ReadPreferenceSetting; -class ReplicaSetMonitorInterface { +class MONGO_MOD_OPEN ReplicaSetMonitorInterface { public: virtual ~ReplicaSetMonitorInterface() = default; diff --git a/src/mongo/client/replica_set_monitor_manager.h b/src/mongo/client/replica_set_monitor_manager.h index fe8fdb93514..1332dc2c5a4 100644 --- a/src/mongo/client/replica_set_monitor_manager.h +++ b/src/mongo/client/replica_set_monitor_manager.h @@ -50,6 +50,7 @@ #include "mongo/util/assert_util.h" #include "mongo/util/concurrency/with_lock.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/string_map.h" @@ -63,7 +64,7 @@ #include #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { class BSONObjBuilder; class ConnectionString; @@ -248,4 +249,4 @@ private: std::make_shared(); }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/retry_strategy.h b/src/mongo/client/retry_strategy.h index 83e0181e0de..3970d908c69 100644 --- a/src/mongo/client/retry_strategy.h +++ b/src/mongo/client/retry_strategy.h @@ -37,6 +37,7 @@ #include "mongo/util/assert_util.h" #include "mongo/util/duration.h" #include "mongo/util/interruptible.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -47,7 +48,7 @@ #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { struct TargetingMetadata { stdx::unordered_set deprioritizedServers; @@ -77,7 +78,7 @@ struct TargetingMetadata { * * See 'runWithRetryStrategy' for a reference usage of retry strategies. */ -class RetryStrategy { +class MONGO_MOD_OPEN RetryStrategy { public: virtual ~RetryStrategy() = default; @@ -486,7 +487,7 @@ public: */ void updateRateParameters(double returnRate, double capacity); - double getBalance_forTest() const; + MONGO_MOD_PUBLIC double getBalance_forTest() const; /** * Appends the stats for the retry budget metrics. @@ -700,4 +701,4 @@ StatusWith runWithRetryStrategy(Interruptible* interruptible, return result; } -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/retry_strategy_server_parameters.idl b/src/mongo/client/retry_strategy_server_parameters.idl index d190e45b68b..a74290a29bb 100644 --- a/src/mongo/client/retry_strategy_server_parameters.idl +++ b/src/mongo/client/retry_strategy_server_parameters.idl @@ -59,6 +59,7 @@ server_parameters: description: >- The maximum amount of retries the server will attempt when encountering retryable errors. + mod_visibility: public set_at: [startup, runtime] cpp_varname: gDefaultClientMaxRetryAttempts cpp_vartype: Atomic diff --git a/src/mongo/client/sasl_client_conversation.h b/src/mongo/client/sasl_client_conversation.h index f6a0207fa31..adfe1e19c00 100644 --- a/src/mongo/client/sasl_client_conversation.h +++ b/src/mongo/client/sasl_client_conversation.h @@ -30,6 +30,7 @@ #pragma once #include "mongo/base/string_data.h" +#include "mongo/util/modules.h" #include @@ -43,7 +44,7 @@ class StatusWith; * Abstract class for implementing the clent-side * of a SASL mechanism conversation. */ -class SaslClientConversation { +class MONGO_MOD_OPEN SaslClientConversation { SaslClientConversation(const SaslClientConversation&) = delete; SaslClientConversation& operator=(const SaslClientConversation&) = delete; diff --git a/src/mongo/client/sasl_client_session.h b/src/mongo/client/sasl_client_session.h index e71730c42a6..de1057ca162 100644 --- a/src/mongo/client/sasl_client_session.h +++ b/src/mongo/client/sasl_client_session.h @@ -31,6 +31,7 @@ #include "mongo/base/status.h" #include "mongo/base/string_data.h" +#include "mongo/util/modules.h" #include #include @@ -52,7 +53,7 @@ namespace mongo { * parameters must be UTF-8 encoded strings with no embedded NUL characters. The * parameterPassword parameter is not constrained. */ -class SaslClientSession { +class MONGO_MOD_UNFORTUNATELY_OPEN SaslClientSession { SaslClientSession(const SaslClientSession&) = delete; SaslClientSession& operator=(const SaslClientSession&) = delete; diff --git a/src/mongo/client/sasl_oidc_client_conversation.h b/src/mongo/client/sasl_oidc_client_conversation.h index 2b77cd0aff9..56ce4c1ba9c 100644 --- a/src/mongo/client/sasl_oidc_client_conversation.h +++ b/src/mongo/client/sasl_oidc_client_conversation.h @@ -32,6 +32,7 @@ #include "mongo/base/string_data.h" #include "mongo/client/sasl_client_conversation.h" #include "mongo/client/sasl_oidc_client_params.h" +#include "mongo/util/modules.h" #include #include @@ -39,7 +40,7 @@ namespace mongo { -class SaslOIDCClientConversation : public SaslClientConversation { +class MONGO_MOD_PUBLIC SaslOIDCClientConversation : public SaslClientConversation { SaslOIDCClientConversation(const SaslOIDCClientConversation&) = delete; SaslOIDCClientConversation& operator=(const SaslOIDCClientConversation&) = delete; diff --git a/src/mongo/client/sasl_oidc_client_params.h b/src/mongo/client/sasl_oidc_client_params.h index 43346579904..deb00f3b32b 100644 --- a/src/mongo/client/sasl_oidc_client_params.h +++ b/src/mongo/client/sasl_oidc_client_params.h @@ -30,10 +30,11 @@ #pragma once #include "mongo/base/string_data.h" +#include "mongo/util/modules.h" #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { using oidcIdPAuthCallbackT = void(StringData, StringData, StringData); /** @@ -67,4 +68,4 @@ struct OIDCClientGlobalParams { }; extern OIDCClientGlobalParams oidcClientGlobalParams; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/client/sdam/sdam_datatypes.h b/src/mongo/client/sdam/sdam_datatypes.h index d51c5e5fd60..e0f1e4d0306 100644 --- a/src/mongo/client/sdam/sdam_datatypes.h +++ b/src/mongo/client/sdam/sdam_datatypes.h @@ -36,6 +36,7 @@ #include "mongo/idl/idl_parser.h" #include "mongo/rpc/topology_version_gen.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -57,7 +58,8 @@ * https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst * for more information. */ -namespace mongo::sdam { +namespace mongo { +namespace MONGO_MOD_PUBLIC sdam { enum class TopologyType { kSingle, kReplicaSetNoPrimary, @@ -147,4 +149,5 @@ using TopologyManagerPtr = std::unique_ptr; class TopologyListener; using TopologyListenerPtr = std::weak_ptr; -}; // namespace mongo::sdam +} // namespace MONGO_MOD_PUBLIC sdam +} // namespace mongo diff --git a/src/mongo/client/sdam/server_description.h b/src/mongo/client/sdam/server_description.h index a091d1f45ff..5bcc3622d66 100644 --- a/src/mongo/client/sdam/server_description.h +++ b/src/mongo/client/sdam/server_description.h @@ -37,6 +37,7 @@ #include "mongo/db/repl/optime.h" #include "mongo/rpc/topology_version_gen.h" #include "mongo/util/clock_source.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -54,7 +55,8 @@ #include #include -namespace mongo::sdam { +namespace mongo { +namespace MONGO_MOD_PUBLIC sdam { class ServerDescription { ServerDescription() = delete; @@ -222,4 +224,5 @@ bool operator==(const mongo::sdam::ServerDescription& a, const mongo::sdam::Serv bool operator!=(const mongo::sdam::ServerDescription& a, const mongo::sdam::ServerDescription& b); std::ostream& operator<<(std::ostream& os, const ServerDescriptionPtr& description); std::ostream& operator<<(std::ostream& os, const ServerDescription& description); -}; // namespace mongo::sdam +} // namespace MONGO_MOD_PUBLIC sdam +} // namespace mongo diff --git a/src/mongo/client/sdam/topology_description_builder.h b/src/mongo/client/sdam/topology_description_builder.h index c27031061b8..a834601347e 100644 --- a/src/mongo/client/sdam/topology_description_builder.h +++ b/src/mongo/client/sdam/topology_description_builder.h @@ -30,6 +30,7 @@ #include "mongo/bson/oid.h" #include "mongo/client/sdam/sdam_datatypes.h" #include "mongo/client/sdam/topology_description.h" +#include "mongo/util/modules.h" #include "mongo/util/uuid.h" #include @@ -42,7 +43,7 @@ namespace mongo::sdam { * This class is used in the unit tests to construct TopologyDescription instances. For production * code, TopologyDescription instances should be constructed using its constructors. */ -class TopologyDescriptionBuilder { +class MONGO_MOD_PUBLIC TopologyDescriptionBuilder { public: TopologyDescriptionBuilder() = default; diff --git a/src/mongo/dbtests/mock/mock_conn_registry.h b/src/mongo/dbtests/mock/mock_conn_registry.h index bcbb10bf0a6..6cab29a4d9f 100644 --- a/src/mongo/dbtests/mock/mock_conn_registry.h +++ b/src/mongo/dbtests/mock/mock_conn_registry.h @@ -37,6 +37,7 @@ #include "mongo/dbtests/mock/mock_remote_db_server.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" +#include "mongo/util/modules.h" #include #include @@ -46,7 +47,7 @@ namespace mongo { * Registry for storing mock servers and can create mock connections to these * servers. */ -class MockConnRegistry { +class MONGO_MOD_PUBLIC MockConnRegistry { public: /** * Initializes the static instance. diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h index cb48a7a07e6..743bea5c940 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.h +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h @@ -49,6 +49,7 @@ #include "mongo/rpc/unique_message.h" #include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/net/ssl_options.h" @@ -68,7 +69,7 @@ namespace mongo { * * Also check out sample usage in dbtests/mock_dbclient_conn_test.cpp */ -class MockDBClientConnection : public mongo::DBClientConnection { +class MONGO_MOD_PUBLIC MockDBClientConnection : public mongo::DBClientConnection { public: /** * An OP_MSG response to a 'find' command. diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.h b/src/mongo/dbtests/mock/mock_remote_db_server.h index 1f797fbff99..b908d638b69 100644 --- a/src/mongo/dbtests/mock/mock_remote_db_server.h +++ b/src/mongo/dbtests/mock/mock_remote_db_server.h @@ -40,6 +40,7 @@ #include "mongo/rpc/unique_message.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/concurrency/spin_lock.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/uuid.h" @@ -50,7 +51,7 @@ #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { namespace projection_executor { class ProjectionExecutor; } // namespace projection_executor @@ -277,4 +278,4 @@ private: mutable SpinLock _lock; }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/executor/async_client_factory.h b/src/mongo/executor/async_client_factory.h index 5c02e7f4493..f5b5278d00c 100644 --- a/src/mongo/executor/async_client_factory.h +++ b/src/mongo/executor/async_client_factory.h @@ -36,6 +36,7 @@ #include "mongo/util/cancellation.h" #include "mongo/util/duration.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" namespace mongo::executor { @@ -44,7 +45,7 @@ namespace mongo::executor { * The factory dictates which transport protocol the TransportLayer provided to startup() should * communicate over. */ -class AsyncClientFactory : public EgressConnectionCloser { +class MONGO_MOD_PUBLIC AsyncClientFactory : public EgressConnectionCloser { public: /** * A handle to a client produced from this factory. diff --git a/src/mongo/executor/async_rpc.h b/src/mongo/executor/async_rpc.h index 92bedd876d7..1a15d906422 100644 --- a/src/mongo/executor/async_rpc.h +++ b/src/mongo/executor/async_rpc.h @@ -62,6 +62,7 @@ #include "mongo/util/duration.h" #include "mongo/util/future.h" #include "mongo/util/future_util.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/out_of_line_executor.h" #include "mongo/util/time_support.h" @@ -83,7 +84,8 @@ * arguments. Each function returns a future containing the response to the command, parsed into the * response-type provided. See the function comments below for details. */ -namespace mongo::async_rpc { +namespace mongo { +namespace MONGO_MOD_PUBLIC async_rpc { using executor::TaskExecutor; /** @@ -151,7 +153,7 @@ struct AsyncRPCInternalResponse { * async_rpc::sendCommand free-function/public API below instead, which contains * additional functionality and type checking. */ -class AsyncRPCRunner { +class MONGO_MOD_USE_REPLACEMENT(async_rpc::sendCommand()) AsyncRPCRunner { public: virtual ~AsyncRPCRunner() = default; virtual ExecutorFuture _sendCommand( @@ -452,4 +454,5 @@ ExecutorFuture> sendCommand( return sendCommand(options, opCtx, cstr); } -} // namespace mongo::async_rpc +} // namespace MONGO_MOD_PUBLIC async_rpc +} // namespace mongo diff --git a/src/mongo/executor/async_rpc_error_info.h b/src/mongo/executor/async_rpc_error_info.h index 19e1de111bc..e54a53dff7e 100644 --- a/src/mongo/executor/async_rpc_error_info.h +++ b/src/mongo/executor/async_rpc_error_info.h @@ -42,6 +42,7 @@ #include "mongo/rpc/get_status_from_command_result_write_util.h" #include "mongo/util/assert_util.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -50,7 +51,7 @@ #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { using executor::RemoteCommandResponse; enum class CommandErrorProvenance { kLocal, kRemote }; @@ -243,4 +244,4 @@ Status unpackRPCStatusIgnoringWriteErrors(Status status); */ Status unpackRPCStatusIgnoringWriteConcernAndWriteErrors(Status status); }; // namespace async_rpc -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/executor/async_rpc_targeter.h b/src/mongo/executor/async_rpc_targeter.h index 9cb7ff3b120..c2f0ed3699d 100644 --- a/src/mongo/executor/async_rpc_targeter.h +++ b/src/mongo/executor/async_rpc_targeter.h @@ -38,12 +38,13 @@ #include "mongo/util/assert_util.h" #include "mongo/util/cancellation.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include namespace mongo { -namespace async_rpc { +namespace MONGO_MOD_PUBLIC async_rpc { class Targeter { public: @@ -102,5 +103,5 @@ private: HostAndPort _host; }; -} // namespace async_rpc +} // namespace MONGO_MOD_PUBLIC async_rpc } // namespace mongo diff --git a/src/mongo/executor/connection_pool.h b/src/mongo/executor/connection_pool.h index a36c026caf5..2858b7f67cd 100644 --- a/src/mongo/executor/connection_pool.h +++ b/src/mongo/executor/connection_pool.h @@ -49,6 +49,7 @@ #include "mongo/util/functional.h" #include "mongo/util/future.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/net/ssl_options.h" #include "mongo/util/observable_mutex.h" @@ -73,7 +74,7 @@ namespace mongo { class BSONObjBuilder; -namespace executor { +namespace MONGO_MOD_PUBLIC executor { /** * The actual user visible connection pool. @@ -396,7 +397,7 @@ private: * * Minimal interface sets a timer with a callback and cancels the timer. */ -class ConnectionPool::TimerInterface { +class MONGO_MOD_UNFORTUNATELY_OPEN ConnectionPool::TimerInterface { TimerInterface(const TimerInterface&) = delete; TimerInterface& operator=(const TimerInterface&) = delete; @@ -431,7 +432,7 @@ public: * specifically callbacks to set them up (connect + auth + whatever else), * refresh them (issue some kind of ping) and manage a timer. */ -class ConnectionPool::ConnectionInterface : public TimerInterface { +class MONGO_MOD_UNFORTUNATELY_OPEN ConnectionPool::ConnectionInterface : public TimerInterface { ConnectionInterface(const ConnectionInterface&) = delete; ConnectionInterface& operator=(const ConnectionInterface&) = delete; @@ -640,7 +641,7 @@ protected: * This factory provides generators for connections, timers and a clock for the * connection pool. */ -class ConnectionPool::DependentTypeFactoryInterface { +class MONGO_MOD_UNFORTUNATELY_OPEN ConnectionPool::DependentTypeFactoryInterface { DependentTypeFactoryInterface(const DependentTypeFactoryInterface&) = delete; DependentTypeFactoryInterface& operator=(const DependentTypeFactoryInterface&) = delete; @@ -694,5 +695,5 @@ inline ClockSource* ConnectionPool::_getFastClockSource() const { return _fastClockSource; } -} // namespace executor +} // namespace MONGO_MOD_PUBLIC executor } // namespace mongo diff --git a/src/mongo/executor/connection_pool_controllers.h b/src/mongo/executor/connection_pool_controllers.h index c0cceb8fc9c..b6402fee4fe 100644 --- a/src/mongo/executor/connection_pool_controllers.h +++ b/src/mongo/executor/connection_pool_controllers.h @@ -35,6 +35,7 @@ #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -60,7 +61,7 @@ namespace mongo::executor { * simply taken from the Optoins the relevant ConnectionPool was started with. However, this * type is intended to be easily extensible to add these features in the future if needed. */ -class DynamicLimitController final : public ConnectionPool::ControllerInterface { +class MONGO_MOD_PUBLIC DynamicLimitController final : public ConnectionPool::ControllerInterface { public: DynamicLimitController(std::function minLoader, std::function maxLoader, diff --git a/src/mongo/executor/connection_pool_stats.h b/src/mongo/executor/connection_pool_stats.h index a1f6c64a1ce..05425ccfe3f 100644 --- a/src/mongo/executor/connection_pool_stats.h +++ b/src/mongo/executor/connection_pool_stats.h @@ -34,6 +34,7 @@ #include "mongo/stdx/unordered_map.h" #include "mongo/util/duration.h" #include "mongo/util/histogram.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -45,7 +46,7 @@ #include namespace mongo { -namespace executor { +namespace MONGO_MOD_PUBLIC executor { namespace details { constexpr inline auto kStartSize = 0; constexpr inline auto kPartitionStepSize = 50; @@ -139,5 +140,5 @@ struct ConnectionPoolStats { StatsByPool statsByPool; }; -} // namespace executor +} // namespace MONGO_MOD_PUBLIC executor } // namespace mongo diff --git a/src/mongo/executor/egress_connection_closer_manager.h b/src/mongo/executor/egress_connection_closer_manager.h index b719ad58c24..7d2b87fd80f 100644 --- a/src/mongo/executor/egress_connection_closer_manager.h +++ b/src/mongo/executor/egress_connection_closer_manager.h @@ -35,6 +35,7 @@ #include "mongo/stdx/unordered_set.h" #include "mongo/transport/session.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include @@ -52,7 +53,7 @@ namespace executor { * EgressConnectionClosers (which register themselves with it) and then interact exclusively with * the manager. */ -class EgressConnectionCloserManager { +class MONGO_MOD_PUBLIC EgressConnectionCloserManager { public: EgressConnectionCloserManager() = default; diff --git a/src/mongo/executor/mock_async_rpc.h b/src/mongo/executor/mock_async_rpc.h index 332c62589ae..723ecce9782 100644 --- a/src/mongo/executor/mock_async_rpc.h +++ b/src/mongo/executor/mock_async_rpc.h @@ -60,6 +60,7 @@ #include "mongo/util/future.h" #include "mongo/util/future_impl.h" #include "mongo/util/future_util.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/producer_consumer_queue.h" #include "mongo/util/string_map.h" @@ -77,7 +78,8 @@ #include #include -namespace mongo::async_rpc { +namespace mongo { +namespace MONGO_MOD_PUBLIC async_rpc { /** * This header provides two mock implementations of the async_rpc::sendCommand API. In @@ -423,4 +425,5 @@ public: } }; -} // namespace mongo::async_rpc +} // namespace MONGO_MOD_PUBLIC async_rpc +} // namespace mongo diff --git a/src/mongo/executor/mock_network_fixture.h b/src/mongo/executor/mock_network_fixture.h index d59e2b59995..f53162dde14 100644 --- a/src/mongo/executor/mock_network_fixture.h +++ b/src/mongo/executor/mock_network_fixture.h @@ -39,6 +39,7 @@ #include "mongo/stdx/thread.h" #include "mongo/util/assert_util.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/time_support.h" #include @@ -123,7 +124,7 @@ namespace mock { * In this example, we only require that A comes before B. We have no requirements for when C * is executed. Therefore, all of {ABC, ACB, CAB} are valid, but {BAC, BCA, CBA} are not valid. */ -class MockNetwork { +class MONGO_MOD_PUBLIC MockNetwork { public: using MatcherFunc = std::function; using ActionFunc = std::function; diff --git a/src/mongo/executor/network_connection_hook.h b/src/mongo/executor/network_connection_hook.h index 9e6c988d6d1..d60162c056e 100644 --- a/src/mongo/executor/network_connection_hook.h +++ b/src/mongo/executor/network_connection_hook.h @@ -31,6 +31,7 @@ #include "mongo/bson/bsonobj.h" #include "mongo/executor/remote_command_request.h" +#include "mongo/util/modules.h" #include @@ -49,7 +50,7 @@ struct RemoteCommandResponse; * An hooking interface for augmenting an implementation of NetworkInterface with domain-specific * host validation and post-connection logic. */ -class NetworkConnectionHook { +class MONGO_MOD_OPEN NetworkConnectionHook { public: virtual ~NetworkConnectionHook() = default; diff --git a/src/mongo/executor/network_interface.h b/src/mongo/executor/network_interface.h index 8b83ad2ea8e..7038e882686 100644 --- a/src/mongo/executor/network_interface.h +++ b/src/mongo/executor/network_interface.h @@ -45,6 +45,7 @@ #include "mongo/util/functional.h" #include "mongo/util/future.h" #include "mongo/util/future_impl.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -68,7 +69,7 @@ extern FailPoint networkInterfaceShouldNotKillPendingRequests; /** * Interface to networking for use by TaskExecutor implementations. */ -class NetworkInterface { +class MONGO_MOD_PUBLIC NetworkInterface { NetworkInterface(const NetworkInterface&) = delete; NetworkInterface& operator=(const NetworkInterface&) = delete; diff --git a/src/mongo/executor/network_interface_factory.h b/src/mongo/executor/network_interface_factory.h index cb38aaeabf8..2d56b5fa432 100644 --- a/src/mongo/executor/network_interface_factory.h +++ b/src/mongo/executor/network_interface_factory.h @@ -35,12 +35,13 @@ #include "mongo/executor/network_interface.h" #include "mongo/rpc/metadata/metadata_hook.h" #include "mongo/transport/transport_layer.h" +#include "mongo/util/modules.h" #include #include namespace mongo { -namespace executor { +namespace MONGO_MOD_PUBLIC executor { /** * Returns a new NetworkInterface that uses a connection pool with the default options. @@ -75,5 +76,5 @@ std::unique_ptr makeNetworkInterfaceWithClientFactory( std::shared_ptr clientFactory, std::unique_ptr metadataHook = nullptr); -} // namespace executor +} // namespace MONGO_MOD_PUBLIC executor } // namespace mongo diff --git a/src/mongo/executor/network_interface_integration_fixture.h b/src/mongo/executor/network_interface_integration_fixture.h index c73d8227704..9dcbfeba56e 100644 --- a/src/mongo/executor/network_interface_integration_fixture.h +++ b/src/mongo/executor/network_interface_integration_fixture.h @@ -49,6 +49,7 @@ #include "mongo/unittest/unittest.h" #include "mongo/util/duration.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" #include #include @@ -82,7 +83,7 @@ inline TaskExecutor::CallbackHandle makeCallbackHandle() { using StartCommandCB = std::function; -class NetworkInterfaceIntegrationFixture : public ExecutorIntegrationTestFixture { +class MONGO_MOD_OPEN NetworkInterfaceIntegrationFixture : public ExecutorIntegrationTestFixture { public: void createNet(); void startNet(); diff --git a/src/mongo/executor/network_interface_mock.h b/src/mongo/executor/network_interface_mock.h index fb704b232ab..1ba22c7d966 100644 --- a/src/mongo/executor/network_interface_mock.h +++ b/src/mongo/executor/network_interface_mock.h @@ -52,6 +52,7 @@ #include "mongo/util/duration.h" #include "mongo/util/functional.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -109,7 +110,7 @@ class NetworkConnectionHook; * be waiting for a response to become available, or for the network thread to move forward and * process that response. */ -class NetworkInterfaceMock : public NetworkInterface { +class MONGO_MOD_PUBLIC NetworkInterfaceMock : public NetworkInterface { public: class NetworkOperation; using NetworkOperationList = std::list; diff --git a/src/mongo/executor/network_interface_thread_pool.h b/src/mongo/executor/network_interface_thread_pool.h index 766ad823b8e..964ad13067b 100644 --- a/src/mongo/executor/network_interface_thread_pool.h +++ b/src/mongo/executor/network_interface_thread_pool.h @@ -33,6 +33,7 @@ #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/thread_pool_interface.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/out_of_line_executor.h" #include @@ -54,7 +55,7 @@ class NetworkInterface; * from on the network interface thread, and queueing them up to be drained by * a setAlarm if not. */ -class NetworkInterfaceThreadPool final : public ThreadPoolInterface { +class MONGO_MOD_NEEDS_REPLACEMENT NetworkInterfaceThreadPool final : public ThreadPoolInterface { public: NetworkInterfaceThreadPool(NetworkInterface* net); ~NetworkInterfaceThreadPool() override; diff --git a/src/mongo/executor/network_interface_tl.h b/src/mongo/executor/network_interface_tl.h index 3ca7b4160d9..aa92ed2caff 100644 --- a/src/mongo/executor/network_interface_tl.h +++ b/src/mongo/executor/network_interface_tl.h @@ -55,6 +55,7 @@ #include "mongo/util/functional.h" #include "mongo/util/future.h" #include "mongo/util/future_impl.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -71,7 +72,7 @@ namespace mongo { namespace executor { -class NetworkInterfaceTL : public NetworkInterface { +class MONGO_MOD_NEEDS_REPLACEMENT NetworkInterfaceTL : public NetworkInterface { public: NetworkInterfaceTL(std::string instanceName, std::shared_ptr factory, @@ -121,7 +122,7 @@ public: Milliseconds timeout, Status status) override; - const AsyncClientFactory& getClientFactory_forTest() const { + MONGO_MOD_NEEDS_REPLACEMENT const AsyncClientFactory& getClientFactory_forTest() const { return *_clientFactory; } diff --git a/src/mongo/executor/network_test_env.h b/src/mongo/executor/network_test_env.h index 6c9f9a6e5e7..c57eb8925af 100644 --- a/src/mongo/executor/network_test_env.h +++ b/src/mongo/executor/network_test_env.h @@ -40,6 +40,7 @@ #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/time_support.h" #include @@ -81,7 +82,7 @@ namespace executor { * * checkResult(future.timed_get(...)); */ -class NetworkTestEnv { +class MONGO_MOD_PUBLIC NetworkTestEnv { public: // Common timeout for tests to use for any work scheduled through launchAsync to complete. static constexpr Minutes kDefaultLaunchAsyncFutureTimeout{5}; diff --git a/src/mongo/executor/remote_command_request.h b/src/mongo/executor/remote_command_request.h index 6ba00f529e3..3570baac828 100644 --- a/src/mongo/executor/remote_command_request.h +++ b/src/mongo/executor/remote_command_request.h @@ -35,6 +35,7 @@ #include "mongo/rpc/metadata.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" #include "mongo/util/uuid.h" @@ -53,7 +54,7 @@ namespace mongo { namespace executor { -struct RemoteCommandRequest { +struct MONGO_MOD_PUBLIC RemoteCommandRequest { // Indicates that there is no timeout for the request to complete static constexpr Milliseconds kNoTimeout{-1}; @@ -120,7 +121,8 @@ struct RemoteCommandRequest { bool operator==(const RemoteCommandRequest& rhs) const; bool operator!=(const RemoteCommandRequest& rhs) const; - friend std::ostream& operator<<(std::ostream& os, const RemoteCommandRequest& response) { + MONGO_MOD_PUBLIC friend std::ostream& operator<<(std::ostream& os, + const RemoteCommandRequest& response) { return (os << response.toString()); } diff --git a/src/mongo/executor/remote_command_response.h b/src/mongo/executor/remote_command_response.h index aaf16301b18..43d783c15f6 100644 --- a/src/mongo/executor/remote_command_response.h +++ b/src/mongo/executor/remote_command_response.h @@ -34,6 +34,7 @@ #include "mongo/bson/bsonobj.h" #include "mongo/rpc/message.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -52,7 +53,7 @@ namespace rpc { class ReplyInterface; } // namespace rpc -namespace executor { +namespace MONGO_MOD_PUBLIC executor { std::vector extractErrorLabels(BSONObj data); @@ -84,11 +85,11 @@ struct RemoteCommandResponse { bool isOK() const; - static RemoteCommandResponse make_forTest(Status s); - static RemoteCommandResponse make_forTest(Status s, Microseconds elapsed); - static RemoteCommandResponse make_forTest(BSONObj dataObj, - Microseconds elapsed, - bool moreToCome = false); + MONGO_MOD_PUBLIC static RemoteCommandResponse make_forTest(Status s); + MONGO_MOD_PUBLIC static RemoteCommandResponse make_forTest(Status s, Microseconds elapsed); + MONGO_MOD_PUBLIC static RemoteCommandResponse make_forTest(BSONObj dataObj, + Microseconds elapsed, + bool moreToCome = false); BSONObj data; // Always owned. May point into message. boost::optional elapsed; @@ -103,5 +104,5 @@ private: RemoteCommandResponse(Status s, Microseconds elapsed); RemoteCommandResponse(BSONObj dataObj, Microseconds elapsed, bool moreToCome); }; -} // namespace executor +} // namespace MONGO_MOD_PUBLIC executor } // namespace mongo