SERVER-113602 Mark module boundaries for `networking` (#43713)

GitOrigin-RevId: 7c34ccb84f68e6de8575af01501a86d427f2e134
This commit is contained in:
Saman Memaripour 2025-11-11 23:29:06 -05:00 committed by MongoDB Bot
parent 0f55732549
commit c7f43c110f
65 changed files with 184 additions and 103 deletions

View File

@ -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

View File

@ -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 <memory>
@ -46,7 +47,7 @@
#include <boost/smart_ptr.hpp>
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<RemoteCommandTargeter> _targeter;
};
} // namespace async_rpc
} // namespace MONGO_MOD_PUBLIC async_rpc
} // namespace mongo

View File

@ -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 <cstddef>
@ -55,7 +56,7 @@ namespace mongo {
class BSONObj;
namespace auth {
namespace MONGO_MOD_PUBLIC auth {
using RunCommandHook = std::function<Future<BSONObj>(OpMsgRequest request)>;
@ -211,5 +212,5 @@ SpeculativeAuthType speculateInternalAuth(const HostAndPort& remoteHost,
BSONObjBuilder* helloRequestBuilder,
std::shared_ptr<SaslClientSession>* saslClientSession);
} // namespace auth
} // namespace MONGO_MOD_PUBLIC auth
} // namespace mongo

View File

@ -31,10 +31,11 @@
#include "mongo/platform/random.h"
#include "mongo/util/duration.h"
#include "mongo/util/modules.h"
#include <cstdint>
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

View File

@ -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"

View File

@ -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"

View File

@ -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 <compare>
@ -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 };

View File

@ -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 <cstdint>
@ -53,7 +54,7 @@
#include <boost/move/utility_core.hpp>
namespace mongo {
namespace MONGO_MOD_PUBLIC mongo {
class BSONObjBuilder;
@ -285,9 +286,9 @@ private:
AtomicWord<bool> _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

View File

@ -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 <boost/none.hpp>
#include <boost/optional/optional.hpp>
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

View File

@ -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,

View File

@ -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 <cstddef>
#include <memory>
@ -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;

View File

@ -31,13 +31,14 @@
#include "mongo/bson/bsonobj.h"
#include "mongo/client/dbclient_cursor.h"
#include "mongo/util/modules.h"
#include <boost/move/utility_core.hpp>
#include <boost/optional/optional.hpp>
namespace mongo {
class DBClientMockCursor : public DBClientCursor {
class MONGO_MOD_PUBLIC DBClientMockCursor : public DBClientCursor {
public:
DBClientMockCursor(mongo::DBClientBase* client,
const BSONArray& mockCollection,

View File

@ -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<ReplicaSetMonitor> 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;

View File

@ -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

View File

@ -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 <functional>
@ -62,7 +63,7 @@
#include <boost/none.hpp>
#include <boost/optional/optional.hpp>
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

View File

@ -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

View File

@ -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 <string>
#include <utility>
@ -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 {

View File

@ -31,6 +31,7 @@
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/util/modules.h"
#include <cstddef>
#include <functional>
@ -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<StringData> userName = boost::none);
} // namespace auth
} // namespace MONGO_MOD_PUBLIC auth
} // namespace mongo

View File

@ -37,6 +37,7 @@ imports:
structs:
MongoShellOptions:
description: "The third argument to `new Mongo(...)`"
mod_visibility: public
fields:
api:
description: "API strict version parameter"

View File

@ -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 <compare>
@ -51,7 +52,7 @@
#include <boost/none.hpp>
#include <boost/optional/optional.hpp>
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

View File

@ -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 <string>
@ -48,7 +49,7 @@
#include <boost/none.hpp>
#include <boost/optional/optional.hpp>
namespace mongo {
namespace MONGO_MOD_PUBLIC mongo {
template <typename T>
class StatusWith;
@ -283,4 +284,4 @@ private:
bool _usedDefaultReadPrefValue = false;
};
} // namespace mongo
} // namespace MONGO_MOD_PUBLIC mongo

View File

@ -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.

View File

@ -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>& tenantId = boost::none);
MONGO_MOD_PUBLIC Status validateMaxStalenessSecondsExternal(
std::int64_t maxStalenessSeconds, const boost::optional<TenantId>& tenantId = boost::none);
} // namespace mongo

View File

@ -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 <cstdlib>
@ -159,6 +160,6 @@ private:
CancellationSource _cancellationSource;
};
bool isMongosRetriableError(const ErrorCodes::Error& code);
MONGO_MOD_PUBLIC bool isMongosRetriableError(const ErrorCodes::Error& code);
} // namespace mongo

View File

@ -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;

View File

@ -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;

View File

@ -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 <memory>
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<RemoteCommandTargeter> create(const ConnectionString& connStr) override;
};
} // namespace mongo
} // namespace MONGO_MOD_PUBLIC mongo

View File

@ -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 <map>
#include <memory>
@ -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;

View File

@ -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 <memory>
@ -48,7 +49,7 @@
namespace mongo {
class RemoteCommandTargeterMock final : public RemoteCommandTargeter {
class MONGO_MOD_PUBLIC RemoteCommandTargeterMock final : public RemoteCommandTargeter {
public:
RemoteCommandTargeterMock();
~RemoteCommandTargeterMock() override;

View File

@ -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 <cstdint>
@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 <boost/move/utility_core.hpp>
#include <boost/optional/optional.hpp>
namespace mongo {
namespace MONGO_MOD_PUBLIC mongo {
class BSONObjBuilder;
class ConnectionString;
@ -248,4 +249,4 @@ private:
std::make_shared<ReplicaSetMonitorManagerStats>();
};
} // namespace mongo
} // namespace MONGO_MOD_PUBLIC mongo

View File

@ -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 <concepts>
@ -47,7 +48,7 @@
#include <boost/optional.hpp>
namespace mongo {
namespace MONGO_MOD_PUBLIC mongo {
struct TargetingMetadata {
stdx::unordered_set<HostAndPort> 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<T> runWithRetryStrategy(Interruptible* interruptible,
return result;
}
} // namespace mongo
} // namespace MONGO_MOD_PUBLIC mongo

View File

@ -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<int32_t>

View File

@ -30,6 +30,7 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/util/modules.h"
#include <string>
@ -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;

View File

@ -31,6 +31,7 @@
#include "mongo/base/status.h"
#include "mongo/base/string_data.h"
#include "mongo/util/modules.h"
#include <cstddef>
#include <functional>
@ -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;

View File

@ -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 <functional>
#include <string>
@ -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;

View File

@ -30,10 +30,11 @@
#pragma once
#include "mongo/base/string_data.h"
#include "mongo/util/modules.h"
#include <boost/optional/optional.hpp>
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

View File

@ -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 <chrono>
@ -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<TopologyManager>;
class TopologyListener;
using TopologyListenerPtr = std::weak_ptr<TopologyListener>;
}; // namespace mongo::sdam
} // namespace MONGO_MOD_PUBLIC sdam
} // namespace mongo

View File

@ -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 <boost/optional.hpp>
#include <boost/optional/optional.hpp>
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

View File

@ -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 <memory>
@ -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;

View File

@ -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 <memory>
#include <string>
@ -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.

View File

@ -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.

View File

@ -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 <boost/move/utility_core.hpp>
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

View File

@ -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.

View File

@ -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<AsyncRPCInternalResponse> _sendCommand(
@ -452,4 +454,5 @@ ExecutorFuture<AsyncRPCResponse<typename CommandType::Reply>> sendCommand(
return sendCommand(options, opCtx, cstr);
}
} // namespace mongo::async_rpc
} // namespace MONGO_MOD_PUBLIC async_rpc
} // namespace mongo

View File

@ -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 <memory>
@ -50,7 +51,7 @@
#include <boost/optional/optional.hpp>
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

View File

@ -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 <vector>
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

View File

@ -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

View File

@ -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 <cstddef>
@ -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<size_t()> minLoader,
std::function<size_t()> maxLoader,

View File

@ -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 <cstddef>
@ -45,7 +46,7 @@
#include <boost/optional/optional.hpp>
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

View File

@ -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 <functional>
@ -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;

View File

@ -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 <utility>
#include <vector>
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

View File

@ -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 <algorithm>
@ -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<bool(const BSONObj&)>;
using ActionFunc = std::function<RemoteCommandResponse(const BSONObj&)>;

View File

@ -31,6 +31,7 @@
#include "mongo/bson/bsonobj.h"
#include "mongo/executor/remote_command_request.h"
#include "mongo/util/modules.h"
#include <boost/optional.hpp>
@ -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;

View File

@ -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;

View File

@ -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 <memory>
#include <string>
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<NetworkInterface> makeNetworkInterfaceWithClientFactory(
std::shared_ptr<AsyncClientFactory> clientFactory,
std::unique_ptr<rpc::EgressMetadataHook> metadataHook = nullptr);
} // namespace executor
} // namespace MONGO_MOD_PUBLIC executor
} // namespace mongo

View File

@ -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 <cstddef>
#include <functional>
@ -82,7 +83,7 @@ inline TaskExecutor::CallbackHandle makeCallbackHandle() {
using StartCommandCB = std::function<void(const RemoteCommandResponse&)>;
class NetworkInterfaceIntegrationFixture : public ExecutorIntegrationTestFixture {
class MONGO_MOD_OPEN NetworkInterfaceIntegrationFixture : public ExecutorIntegrationTestFixture {
public:
void createNet();
void startNet();

View File

@ -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<NetworkOperation>;

View File

@ -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 <cstdint>
@ -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;

View File

@ -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<AsyncClientFactory> 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;
}

View File

@ -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 <chrono>
@ -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};

View File

@ -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());
}

View File

@ -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<std::string> 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<Microseconds> 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