diff options
243 files changed, 569 insertions, 588 deletions
diff --git a/src/mongo/base/initializer_function.h b/src/mongo/base/initializer_function.h index 7d3575cfd90..2050013c997 100644 --- a/src/mongo/base/initializer_function.h +++ b/src/mongo/base/initializer_function.h @@ -29,8 +29,9 @@ #pragma once +#include <functional> + #include "mongo/base/status.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -43,7 +44,7 @@ class DeinitializerContext; * On successful execution, an InitializerFunction returns Status::OK(). It may * inspect and mutate the supplied InitializerContext. */ -typedef stdx::function<Status(InitializerContext*)> InitializerFunction; +typedef std::function<Status(InitializerContext*)> InitializerFunction; /** * A DeinitializerFunction implements the behavior of a deinitializer operation. @@ -51,7 +52,7 @@ typedef stdx::function<Status(InitializerContext*)> InitializerFunction; * On successful execution, a DeinitializerFunction returns Status::OK(). It may * inspect and mutate the supplied DeinitializerContext. */ -typedef stdx::function<Status(DeinitializerContext*)> DeinitializerFunction; +typedef std::function<Status(DeinitializerContext*)> DeinitializerFunction; } // namespace mongo diff --git a/src/mongo/bson/util/bson_extract.cpp b/src/mongo/bson/util/bson_extract.cpp index 481c26df5fe..acd52ce7d82 100644 --- a/src/mongo/bson/util/bson_extract.cpp +++ b/src/mongo/bson/util/bson_extract.cpp @@ -251,7 +251,7 @@ Status bsonExtractIntegerFieldWithDefault(const BSONObj& object, Status bsonExtractIntegerFieldWithDefaultIf(const BSONObj& object, StringData fieldName, long long defaultValue, - stdx::function<bool(long long)> pred, + std::function<bool(long long)> pred, const std::string& predDescription, long long* out) { Status status = bsonExtractIntegerFieldWithDefault(object, fieldName, defaultValue, out); @@ -270,7 +270,7 @@ Status bsonExtractIntegerFieldWithDefaultIf(const BSONObj& object, Status bsonExtractIntegerFieldWithDefaultIf(const BSONObj& object, StringData fieldName, long long defaultValue, - stdx::function<bool(long long)> pred, + std::function<bool(long long)> pred, long long* out) { return bsonExtractIntegerFieldWithDefaultIf( object, fieldName, defaultValue, pred, "constraint failed", out); diff --git a/src/mongo/bson/util/bson_extract.h b/src/mongo/bson/util/bson_extract.h index 4dad3473377..8be7e0393ed 100644 --- a/src/mongo/bson/util/bson_extract.h +++ b/src/mongo/bson/util/bson_extract.h @@ -29,13 +29,13 @@ #pragma once +#include <functional> #include <string> #include <vector> #include "mongo/base/status.h" #include "mongo/base/string_data.h" #include "mongo/bson/bsontypes.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -216,14 +216,14 @@ Status bsonExtractOIDFieldWithDefault(const BSONObj& object, Status bsonExtractIntegerFieldWithDefaultIf(const BSONObj& object, StringData fieldName, long long defaultValue, - stdx::function<bool(long long)> pred, + std::function<bool(long long)> pred, const std::string& predDescription, long long* out); Status bsonExtractIntegerFieldWithDefaultIf(const BSONObj& object, StringData fieldName, long long defaultValue, - stdx::function<bool(long long)> pred, + std::function<bool(long long)> pred, long long* out); } // namespace mongo diff --git a/src/mongo/bson/util/bson_extract_test.cpp b/src/mongo/bson/util/bson_extract_test.cpp index c8d90a59d3c..dbb76f1a9c7 100644 --- a/src/mongo/bson/util/bson_extract_test.cpp +++ b/src/mongo/bson/util/bson_extract_test.cpp @@ -34,7 +34,6 @@ #include "mongo/bson/util/bson_extract.h" #include "mongo/db/jsobj.h" #include "mongo/db/repl/optime.h" -#include "mongo/stdx/functional.h" #include "mongo/unittest/unittest.h" using namespace mongo; diff --git a/src/mongo/client/authenticate.h b/src/mongo/client/authenticate.h index e5825e52111..15c9cd0b9b4 100644 --- a/src/mongo/client/authenticate.h +++ b/src/mongo/client/authenticate.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <string> #include "mongo/base/status_with.h" @@ -37,7 +38,6 @@ #include "mongo/db/auth/user_name.h" #include "mongo/executor/remote_command_response.h" #include "mongo/rpc/op_msg.h" -#include "mongo/stdx/functional.h" #include "mongo/util/future.h" #include "mongo/util/md5.h" #include "mongo/util/net/hostandport.h" @@ -48,10 +48,10 @@ class BSONObj; namespace auth { -using RunCommandHook = stdx::function<Future<BSONObj>(OpMsgRequest request)>; +using RunCommandHook = std::function<Future<BSONObj>(OpMsgRequest request)>; /* Hook for legacy MONGODB-CR support provided by shell client only */ -using AuthMongoCRHandler = stdx::function<Future<void>(RunCommandHook, const BSONObj&)>; +using AuthMongoCRHandler = std::function<Future<void>(RunCommandHook, const BSONObj&)>; extern AuthMongoCRHandler authMongoCR; /** diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp index befee2a0350..dcf30fa1881 100644 --- a/src/mongo/client/dbclient_base.cpp +++ b/src/mongo/client/dbclient_base.cpp @@ -710,10 +710,10 @@ struct DBClientFunConvertor { _f(i.nextSafe()); } } - stdx::function<void(const BSONObj&)> _f; + std::function<void(const BSONObj&)> _f; }; -unsigned long long DBClientBase::query(stdx::function<void(const BSONObj&)> f, +unsigned long long DBClientBase::query(std::function<void(const BSONObj&)> f, const NamespaceStringOrUUID& nsOrUuid, Query query, const BSONObj* fieldsToReturn, @@ -721,11 +721,11 @@ unsigned long long DBClientBase::query(stdx::function<void(const BSONObj&)> f, int batchSize) { DBClientFunConvertor fun; fun._f = f; - stdx::function<void(DBClientCursorBatchIterator&)> ptr(fun); + std::function<void(DBClientCursorBatchIterator&)> ptr(fun); return this->query(ptr, nsOrUuid, query, fieldsToReturn, queryOptions, batchSize); } -unsigned long long DBClientBase::query(stdx::function<void(DBClientCursorBatchIterator&)> f, +unsigned long long DBClientBase::query(std::function<void(DBClientCursorBatchIterator&)> f, const NamespaceStringOrUUID& nsOrUuid, Query query, const BSONObj* fieldsToReturn, diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h index ea8914e3fed..558cc3efa8e 100644 --- a/src/mongo/client/dbclient_base.h +++ b/src/mongo/client/dbclient_base.h @@ -30,6 +30,7 @@ #pragma once #include <cstdint> +#include <functional> #include "mongo/base/string_data.h" #include "mongo/client/authenticate.h" @@ -49,7 +50,6 @@ #include "mongo/rpc/op_msg.h" #include "mongo/rpc/protocol.h" #include "mongo/rpc/unique_message.h" -#include "mongo/stdx/functional.h" #include "mongo/transport/message_compressor_manager.h" #include "mongo/transport/session.h" #include "mongo/transport/transport_layer.h" @@ -81,14 +81,14 @@ class DBClientQueryInterface { int queryOptions = 0, int batchSize = 0) = 0; - virtual unsigned long long query(stdx::function<void(const BSONObj&)> f, + virtual unsigned long long query(std::function<void(const BSONObj&)> f, const NamespaceStringOrUUID& nsOrUuid, Query query, const BSONObj* fieldsToReturn = 0, int queryOptions = 0, int batchSize = 0) = 0; - virtual unsigned long long query(stdx::function<void(DBClientCursorBatchIterator&)> f, + virtual unsigned long long query(std::function<void(DBClientCursorBatchIterator&)> f, const NamespaceStringOrUUID& nsOrUuid, Query query, const BSONObj* fieldsToReturn = 0, @@ -200,7 +200,7 @@ public: /** * Gets the RequestMetadataWriter that is set on this connection. This may - * be an uninitialized stdx::function, so it should be checked for validity + * be an uninitialized std::function, so it should be checked for validity * with operator bool() first. */ const rpc::RequestMetadataWriter& getRequestMetadataWriter(); @@ -214,7 +214,7 @@ public: /** * Gets the ReplyMetadataReader that is set on this connection. This may - * be an uninitialized stdx::function, so it should be checked for validity + * be an uninitialized std::function, so it should be checked for validity * with operator bool() first. */ const rpc::ReplyMetadataReader& getReplyMetadataReader(); @@ -602,14 +602,14 @@ public: The version that takes a BSONObj cannot return the namespace queried when the query is is done by UUID. If this is required, use the DBClientBatchIterator version. */ - unsigned long long query(stdx::function<void(const BSONObj&)> f, + unsigned long long query(std::function<void(const BSONObj&)> f, const NamespaceStringOrUUID& nsOrUuid, Query query, const BSONObj* fieldsToReturn = 0, int queryOptions = QueryOption_Exhaust, int batchSize = 0) final; - unsigned long long query(stdx::function<void(DBClientCursorBatchIterator&)> f, + unsigned long long query(std::function<void(DBClientCursorBatchIterator&)> f, const NamespaceStringOrUUID& nsOrUuid, Query query, const BSONObj* fieldsToReturn = 0, diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp index 938c1167fbc..c812cea4a11 100644 --- a/src/mongo/client/dbclient_connection.cpp +++ b/src/mongo/client/dbclient_connection.cpp @@ -38,6 +38,7 @@ #include "mongo/client/dbclient_connection.h" #include <algorithm> +#include <functional> #include <utility> #include "mongo/base/status.h" @@ -63,7 +64,6 @@ #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/metadata/client_metadata.h" #include "mongo/s/stale_exception.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" @@ -520,7 +520,7 @@ uint64_t DBClientConnection::getSockCreationMicroSec() const { } } -unsigned long long DBClientConnection::query(stdx::function<void(DBClientCursorBatchIterator&)> f, +unsigned long long DBClientConnection::query(std::function<void(DBClientCursorBatchIterator&)> f, const NamespaceStringOrUUID& nsOrUuid, Query query, const BSONObj* fieldsToReturn, diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h index 13788423545..dc2f9ae7f6c 100644 --- a/src/mongo/client/dbclient_connection.h +++ b/src/mongo/client/dbclient_connection.h @@ -30,6 +30,7 @@ #pragma once #include <cstdint> +#include <functional> #include "mongo/base/string_data.h" #include "mongo/client/connection_string.h" @@ -48,7 +49,6 @@ #include "mongo/rpc/op_msg.h" #include "mongo/rpc/protocol.h" #include "mongo/rpc/unique_message.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/transport/message_compressor_manager.h" #include "mongo/transport/session.h" @@ -83,7 +83,7 @@ public: * status. */ using HandshakeValidationHook = - stdx::function<Status(const executor::RemoteCommandResponse& isMasterReply)>; + std::function<Status(const executor::RemoteCommandResponse& isMasterReply)>; /** @param _autoReconnect if true, automatically reconnect on a connection failure @@ -162,7 +162,7 @@ public: nsOrUuid, query, nToReturn, nToSkip, fieldsToReturn, queryOptions, batchSize); } - unsigned long long query(stdx::function<void(DBClientCursorBatchIterator&)> f, + unsigned long long query(std::function<void(DBClientCursorBatchIterator&)> f, const NamespaceStringOrUUID& nsOrUuid, Query query, const BSONObj* fieldsToReturn, diff --git a/src/mongo/client/fetcher.h b/src/mongo/client/fetcher.h index 3f877a0c9ec..78bbdc378b8 100644 --- a/src/mongo/client/fetcher.h +++ b/src/mongo/client/fetcher.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <iosfwd> #include <memory> #include <string> @@ -42,7 +43,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/executor/task_executor.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/net/hostandport.h" @@ -84,7 +84,7 @@ public: /** * Type of a fetcher callback function. */ - typedef stdx::function<void(const StatusWith<QueryResponse>&, NextAction*, BSONObjBuilder*)> + typedef std::function<void(const StatusWith<QueryResponse>&, NextAction*, BSONObjBuilder*)> CallbackFn; /** diff --git a/src/mongo/client/remote_command_retry_scheduler_test.cpp b/src/mongo/client/remote_command_retry_scheduler_test.cpp index 4ef9699d225..b8536d0fa48 100644 --- a/src/mongo/client/remote_command_retry_scheduler_test.cpp +++ b/src/mongo/client/remote_command_retry_scheduler_test.cpp @@ -321,7 +321,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, auto policy = RemoteCommandRetryScheduler::makeRetryPolicy( 10U, Milliseconds(1), {ErrorCodes::HostUnreachable}); RemoteCommandRetryScheduler scheduler( - &getExecutor(), request, stdx::ref(callback), std::move(policy)); + &getExecutor(), request, std::ref(callback), std::move(policy)); start(&scheduler); auto net = getNet(); @@ -343,7 +343,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, auto policy = RemoteCommandRetryScheduler::makeRetryPolicy( 10U, Milliseconds(1), {ErrorCodes::HostUnreachable}); RemoteCommandRetryScheduler scheduler( - &getExecutor(), request, stdx::ref(callback), std::move(policy)); + &getExecutor(), request, std::ref(callback), std::move(policy)); start(&scheduler); scheduler.shutdown(); @@ -358,7 +358,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, SchedulerInvokesCallbackOnNonRetryableEr auto policy = RemoteCommandRetryScheduler::makeRetryPolicy( 10U, Milliseconds(1), RemoteCommandRetryScheduler::kNotMasterErrors); RemoteCommandRetryScheduler scheduler( - &getExecutor(), request, stdx::ref(callback), std::move(policy)); + &getExecutor(), request, std::ref(callback), std::move(policy)); start(&scheduler); // This should match one of the non-retryable error codes in the policy. @@ -375,7 +375,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, SchedulerInvokesCallbackOnFirstSuccessfu auto policy = RemoteCommandRetryScheduler::makeRetryPolicy( 10U, Milliseconds(1), {ErrorCodes::HostUnreachable}); RemoteCommandRetryScheduler scheduler( - &getExecutor(), request, stdx::ref(callback), std::move(policy)); + &getExecutor(), request, std::ref(callback), std::move(policy)); start(&scheduler); // Elapsed time in response is ignored on successful responses. @@ -394,7 +394,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, SchedulerIgnoresEmbeddedErrorInSuccessfu auto policy = RemoteCommandRetryScheduler::makeRetryPolicy( 10U, Milliseconds(1), {ErrorCodes::HostUnreachable}); RemoteCommandRetryScheduler scheduler( - &getExecutor(), request, stdx::ref(callback), std::move(policy)); + &getExecutor(), request, std::ref(callback), std::move(policy)); start(&scheduler); // Scheduler does not parse document in a successful response for embedded errors. @@ -417,7 +417,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, 3U, executor::RemoteCommandRequest::kNoTimeout, {ErrorCodes::HostNotFound}); TaskExecutorWithFailureInScheduleRemoteCommand badExecutor(&getExecutor()); RemoteCommandRetryScheduler scheduler( - &badExecutor, request, stdx::ref(callback), std::move(policy)); + &badExecutor, request, std::ref(callback), std::move(policy)); start(&scheduler); processNetworkResponse({ErrorCodes::HostNotFound, "first", Milliseconds(0)}); @@ -439,7 +439,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, executor::RemoteCommandRequest::kNoTimeout, RemoteCommandRetryScheduler::kAllRetriableErrors); RemoteCommandRetryScheduler scheduler( - &getExecutor(), request, stdx::ref(callback), std::move(policy)); + &getExecutor(), request, std::ref(callback), std::move(policy)); start(&scheduler); processNetworkResponse({ErrorCodes::HostNotFound, "first", Milliseconds(0)}); @@ -455,7 +455,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, SchedulerShouldRetryUntilSuccessfulRespo auto policy = RemoteCommandRetryScheduler::makeRetryPolicy( 3U, executor::RemoteCommandRequest::kNoTimeout, {ErrorCodes::HostNotFound}); RemoteCommandRetryScheduler scheduler( - &getExecutor(), request, stdx::ref(callback), std::move(policy)); + &getExecutor(), request, std::ref(callback), std::move(policy)); start(&scheduler); processNetworkResponse({ErrorCodes::HostNotFound, "first", Milliseconds(0)}); @@ -502,7 +502,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, auto policyPtr = policy.get(); TaskExecutorWithFailureInScheduleRemoteCommand badExecutor(&getExecutor()); RemoteCommandRetryScheduler scheduler( - &badExecutor, request, stdx::ref(callback), std::move(policy)); + &badExecutor, request, std::ref(callback), std::move(policy)); policyPtr->scheduler = &scheduler; start(&scheduler); diff --git a/src/mongo/client/replica_set_monitor.cpp b/src/mongo/client/replica_set_monitor.cpp index 113673ad1b5..cca254b4007 100644 --- a/src/mongo/client/replica_set_monitor.cpp +++ b/src/mongo/client/replica_set_monitor.cpp @@ -1075,7 +1075,7 @@ std::vector<HostAndPort> SetState::getMatchingHosts(const ReadPreferenceSetting& // The difference between these is handled by Node::matches case ReadPreference::SecondaryOnly: case ReadPreference::Nearest: { - stdx::function<bool(const Node&)> matchNode = [](const Node& node) -> bool { + std::function<bool(const Node&)> matchNode = [](const Node& node) -> bool { return true; }; // build comparator diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h index f572c826600..ec59ce58eb3 100644 --- a/src/mongo/client/replica_set_monitor.h +++ b/src/mongo/client/replica_set_monitor.h @@ -30,7 +30,7 @@ #pragma once #include <atomic> -#include <memory> +#include <functional> #include <memory> #include <set> #include <string> @@ -40,7 +40,6 @@ #include "mongo/client/replica_set_change_notifier.h" #include "mongo/executor/task_executor.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/with_lock.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" diff --git a/src/mongo/client/sasl_client_session.h b/src/mongo/client/sasl_client_session.h index dcb0df60e62..ae384359e20 100644 --- a/src/mongo/client/sasl_client_session.h +++ b/src/mongo/client/sasl_client_session.h @@ -29,12 +29,12 @@ #pragma once +#include <functional> #include <memory> #include <string> #include "mongo/base/status.h" #include "mongo/base/string_data.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -56,7 +56,7 @@ class SaslClientSession { SaslClientSession& operator=(const SaslClientSession&) = delete; public: - typedef stdx::function<SaslClientSession*(const std::string&)> SaslClientSessionFactoryFn; + typedef std::function<SaslClientSession*(const std::string&)> SaslClientSessionFactoryFn; static SaslClientSessionFactoryFn create; /** diff --git a/src/mongo/db/auth/authorization_manager.h b/src/mongo/db/auth/authorization_manager.h index 0646954b6ae..19034dee81b 100644 --- a/src/mongo/db/auth/authorization_manager.h +++ b/src/mongo/db/auth/authorization_manager.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <memory> #include <string> @@ -49,7 +50,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/db/server_options.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" diff --git a/src/mongo/db/auth/authorization_manager_impl.h b/src/mongo/db/auth/authorization_manager_impl.h index 830e6094bce..d18b6e7724a 100644 --- a/src/mongo/db/auth/authorization_manager_impl.h +++ b/src/mongo/db/auth/authorization_manager_impl.h @@ -31,6 +31,7 @@ #include "mongo/db/auth/authorization_manager.h" +#include <functional> #include <memory> #include <mutex> #include <string> @@ -50,7 +51,6 @@ #include "mongo/db/server_options.h" #include "mongo/platform/atomic_word.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/invalidating_lru_cache.h" diff --git a/src/mongo/db/auth/authorization_session_test.cpp b/src/mongo/db/auth/authorization_session_test.cpp index b0ec73151e4..184706257a1 100644 --- a/src/mongo/db/auth/authorization_session_test.cpp +++ b/src/mongo/db/auth/authorization_session_test.cpp @@ -1013,7 +1013,7 @@ TEST_F(AuthorizationSessionTest, CheckAuthForAggregateWithDeeplyNestedLookup) { // Recursively adds nested $lookup stages to 'pipelineBob', building a pipeline with // 'levelsToGo' deep $lookup stages. - stdx::function<void(BSONArrayBuilder*, int)> addNestedPipeline; + std::function<void(BSONArrayBuilder*, int)> addNestedPipeline; addNestedPipeline = [&addNestedPipeline](BSONArrayBuilder* pipelineBob, int levelsToGo) { if (levelsToGo == 0) { return; diff --git a/src/mongo/db/auth/authz_manager_external_state.h b/src/mongo/db/auth/authz_manager_external_state.h index d4f2539c7f5..e18963fefb3 100644 --- a/src/mongo/db/auth/authz_manager_external_state.h +++ b/src/mongo/db/auth/authz_manager_external_state.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <memory> #include <string> #include <vector> @@ -42,7 +43,6 @@ #include "mongo/db/auth/user.h" #include "mongo/db/auth/user_name.h" #include "mongo/db/jsobj.h" -#include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/auth/authz_manager_external_state_d.cpp b/src/mongo/db/auth/authz_manager_external_state_d.cpp index 1f58ef1ecf4..2257f144aed 100644 --- a/src/mongo/db/auth/authz_manager_external_state_d.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_d.cpp @@ -63,7 +63,7 @@ Status AuthzManagerExternalStateMongod::query( const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const stdx::function<void(const BSONObj&)>& resultProcessor) { + const std::function<void(const BSONObj&)>& resultProcessor) { try { DBDirectClient client(opCtx); client.query(resultProcessor, collectionName, query, &projection); diff --git a/src/mongo/db/auth/authz_manager_external_state_d.h b/src/mongo/db/auth/authz_manager_external_state_d.h index 97cbc1b074b..289a7567236 100644 --- a/src/mongo/db/auth/authz_manager_external_state_d.h +++ b/src/mongo/db/auth/authz_manager_external_state_d.h @@ -29,13 +29,13 @@ #pragma once +#include <functional> #include <string> #include "mongo/base/status.h" #include "mongo/db/auth/authz_manager_external_state_local.h" #include "mongo/db/auth/role_graph.h" #include "mongo/db/auth/user_name.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -61,7 +61,7 @@ public: const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const stdx::function<void(const BSONObj&)>& resultProcessor); + const std::function<void(const BSONObj&)>& resultProcessor); }; } // namespace mongo diff --git a/src/mongo/db/auth/authz_manager_external_state_local.h b/src/mongo/db/auth/authz_manager_external_state_local.h index 5ddb737b4f5..31b3869f114 100644 --- a/src/mongo/db/auth/authz_manager_external_state_local.h +++ b/src/mongo/db/auth/authz_manager_external_state_local.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <string> #include "mongo/base/status.h" @@ -36,7 +37,6 @@ #include "mongo/db/auth/role_graph.h" #include "mongo/db/auth/role_name.h" #include "mongo/db/auth/user_name.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { @@ -101,7 +101,7 @@ public: const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const stdx::function<void(const BSONObj&)>& resultProcessor) = 0; + const std::function<void(const BSONObj&)>& resultProcessor) = 0; void logOp(OperationContext* opCtx, AuthorizationManagerImpl* authManager, diff --git a/src/mongo/db/auth/authz_manager_external_state_mock.cpp b/src/mongo/db/auth/authz_manager_external_state_mock.cpp index acaf8389712..e4951dc4c8c 100644 --- a/src/mongo/db/auth/authz_manager_external_state_mock.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_mock.cpp @@ -130,7 +130,7 @@ Status AuthzManagerExternalStateMock::query( const NamespaceString& collectionName, const BSONObj& query, const BSONObj&, - const stdx::function<void(const BSONObj&)>& resultProcessor) { + const std::function<void(const BSONObj&)>& resultProcessor) { std::vector<BSONObjCollection::iterator> iterVector; Status status = _queryVector(opCtx, collectionName, query, &iterVector); if (!status.isOK()) { diff --git a/src/mongo/db/auth/authz_manager_external_state_mock.h b/src/mongo/db/auth/authz_manager_external_state_mock.h index 9d316a764f9..670c73c924f 100644 --- a/src/mongo/db/auth/authz_manager_external_state_mock.h +++ b/src/mongo/db/auth/authz_manager_external_state_mock.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <map> #include <string> #include <vector> @@ -38,7 +39,6 @@ #include "mongo/db/auth/role_graph.h" #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -70,7 +70,7 @@ public: const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, // Currently unused in mock - const stdx::function<void(const BSONObj&)>& resultProcessor); + const std::function<void(const BSONObj&)>& resultProcessor); /** * Inserts the given user object into the "admin" database. diff --git a/src/mongo/db/auth/authz_manager_external_state_s.h b/src/mongo/db/auth/authz_manager_external_state_s.h index f0f1e476c8a..4e20418a446 100644 --- a/src/mongo/db/auth/authz_manager_external_state_s.h +++ b/src/mongo/db/auth/authz_manager_external_state_s.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <memory> #include <string> @@ -36,7 +37,6 @@ #include "mongo/db/auth/authz_manager_external_state.h" #include "mongo/db/auth/privilege_format.h" #include "mongo/db/auth/user_name.h" -#include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/auth/sasl_scram_test.cpp b/src/mongo/db/auth/sasl_scram_test.cpp index b16d58b9288..0a6ee532849 100644 --- a/src/mongo/db/auth/sasl_scram_test.cpp +++ b/src/mongo/db/auth/sasl_scram_test.cpp @@ -139,7 +139,7 @@ class SCRAMMutators { public: SCRAMMutators() {} - void setMutator(SaslTestState state, stdx::function<void(std::string&)> fun) { + void setMutator(SaslTestState state, std::function<void(std::string&)> fun) { mutators.insert(std::make_pair(state, fun)); } @@ -151,7 +151,7 @@ public: } private: - std::map<SaslTestState, stdx::function<void(std::string&)>> mutators; + std::map<SaslTestState, std::function<void(std::string&)>> mutators; }; struct SCRAMStepsResult { diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h index d9abc6816cd..d3b71a184fb 100644 --- a/src/mongo/db/catalog/collection.h +++ b/src/mongo/db/catalog/collection.h @@ -30,6 +30,7 @@ #pragma once #include <cstdint> +#include <functional> #include <memory> #include <string> #include <vector> @@ -52,7 +53,6 @@ #include "mongo/db/storage/record_store.h" #include "mongo/db/storage/snapshot.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { @@ -184,7 +184,7 @@ public: /** * Callback function for callers of insertDocumentForBulkLoader(). */ - using OnRecordInsertedFn = stdx::function<Status(const RecordId& loc)>; + using OnRecordInsertedFn = std::function<Status(const RecordId& loc)>; Collection() = default; virtual ~Collection() = default; diff --git a/src/mongo/db/catalog/collection_catalog.h b/src/mongo/db/catalog/collection_catalog.h index 475d12241fe..fcd2b0fde7b 100644 --- a/src/mongo/db/catalog/collection_catalog.h +++ b/src/mongo/db/catalog/collection_catalog.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <map> #include <set> #include <unordered_map> @@ -36,7 +37,6 @@ #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/collection_catalog_entry.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/functional.h" #include "mongo/util/uuid.h" namespace mongo { diff --git a/src/mongo/db/catalog/index_builds_manager.h b/src/mongo/db/catalog/index_builds_manager.h index d72915f5d19..21678546061 100644 --- a/src/mongo/db/catalog/index_builds_manager.h +++ b/src/mongo/db/catalog/index_builds_manager.h @@ -29,13 +29,13 @@ #pragma once +#include <functional> #include <map> #include <string> #include <vector> #include "mongo/db/catalog/multi_index_block.h" #include "mongo/db/namespace_string.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { diff --git a/src/mongo/db/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h index 78c87b8f9cd..9c9b7f7b8b7 100644 --- a/src/mongo/db/catalog/index_catalog.h +++ b/src/mongo/db/catalog/index_catalog.h @@ -395,7 +395,7 @@ public: */ virtual void dropAllIndexes(OperationContext* opCtx, bool includingIdIndex, - stdx::function<void(const IndexDescriptor*)> onDropFn) = 0; + std::function<void(const IndexDescriptor*)> onDropFn) = 0; virtual void dropAllIndexes(OperationContext* opCtx, bool includingIdIndex) = 0; /** diff --git a/src/mongo/db/catalog/index_catalog_entry.h b/src/mongo/db/catalog/index_catalog_entry.h index 463700dd3fd..46b35196513 100644 --- a/src/mongo/db/catalog/index_catalog_entry.h +++ b/src/mongo/db/catalog/index_catalog_entry.h @@ -30,6 +30,7 @@ #pragma once #include <boost/optional.hpp> +#include <functional> #include <string> #include "mongo/base/owned_pointer_vector.h" @@ -39,7 +40,6 @@ #include "mongo/db/record_id.h" #include "mongo/db/storage/kv/kv_prefix.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/debug_util.h" diff --git a/src/mongo/db/catalog/index_catalog_impl.cpp b/src/mongo/db/catalog/index_catalog_impl.cpp index 0924c0e8098..a634d4c8157 100644 --- a/src/mongo/db/catalog/index_catalog_impl.cpp +++ b/src/mongo/db/catalog/index_catalog_impl.cpp @@ -843,7 +843,7 @@ BSONObj IndexCatalogImpl::getDefaultIdIndexSpec() const { void IndexCatalogImpl::dropAllIndexes(OperationContext* opCtx, bool includingIdIndex, - stdx::function<void(const IndexDescriptor*)> onDropFn) { + std::function<void(const IndexDescriptor*)> onDropFn) { invariant(opCtx->lockState()->isCollectionLockedForMode(_collection->ns(), MODE_X)); uassert(ErrorCodes::BackgroundOperationInProgressForNamespace, diff --git a/src/mongo/db/catalog/index_catalog_impl.h b/src/mongo/db/catalog/index_catalog_impl.h index 7d0f54b3de4..21445b5fba9 100644 --- a/src/mongo/db/catalog/index_catalog_impl.h +++ b/src/mongo/db/catalog/index_catalog_impl.h @@ -200,7 +200,7 @@ public: */ void dropAllIndexes(OperationContext* opCtx, bool includingIdIndex, - stdx::function<void(const IndexDescriptor*)> onDropFn) override; + std::function<void(const IndexDescriptor*)> onDropFn) override; void dropAllIndexes(OperationContext* opCtx, bool includingIdIndex) override; /** diff --git a/src/mongo/db/catalog/index_catalog_noop.h b/src/mongo/db/catalog/index_catalog_noop.h index e25e1693904..3814a54ea17 100644 --- a/src/mongo/db/catalog/index_catalog_noop.h +++ b/src/mongo/db/catalog/index_catalog_noop.h @@ -157,7 +157,7 @@ public: void dropAllIndexes(OperationContext* opCtx, bool includingIdIndex, - stdx::function<void(const IndexDescriptor*)> onDropFn) override {} + std::function<void(const IndexDescriptor*)> onDropFn) override {} void dropAllIndexes(OperationContext* opCtx, bool includingIdIndex) override {} diff --git a/src/mongo/db/catalog/multi_index_block.h b/src/mongo/db/catalog/multi_index_block.h index 7b1b1d3e86c..af53fa21e04 100644 --- a/src/mongo/db/catalog/multi_index_block.h +++ b/src/mongo/db/catalog/multi_index_block.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <iosfwd> #include <memory> #include <set> @@ -44,7 +45,6 @@ #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/index/index_access_method.h" #include "mongo/db/record_id.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/fail_point_service.h" @@ -111,7 +111,7 @@ public: * * Requires holding an exclusive database lock. */ - using OnInitFn = stdx::function<Status(std::vector<BSONObj>& specs)>; + using OnInitFn = std::function<Status(std::vector<BSONObj>& specs)>; StatusWith<std::vector<BSONObj>> init(OperationContext* opCtx, Collection* collection, const std::vector<BSONObj>& specs, @@ -210,8 +210,8 @@ public: * * Requires holding an exclusive database lock. */ - using OnCommitFn = stdx::function<void()>; - using OnCreateEachFn = stdx::function<void(const BSONObj& spec)>; + using OnCommitFn = std::function<void()>; + using OnCreateEachFn = std::function<void(const BSONObj& spec)>; Status commit(OperationContext* opCtx, Collection* collection, OnCreateEachFn onCreateEach, diff --git a/src/mongo/db/catalog_raii_test.cpp b/src/mongo/db/catalog_raii_test.cpp index 9ca2b4cdde4..c027b58dd27 100644 --- a/src/mongo/db/catalog_raii_test.cpp +++ b/src/mongo/db/catalog_raii_test.cpp @@ -73,7 +73,7 @@ void CatalogRAIITestFixture::setUp() { DatabaseHolder::set(getServiceContext(), std::make_unique<DatabaseHolderMock>()); } -void failsWithLockTimeout(stdx::function<void()> func, Milliseconds timeoutMillis) { +void failsWithLockTimeout(std::function<void()> func, Milliseconds timeoutMillis) { Date_t t1 = Date_t::now(); try { func(); diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index 4694031ccc1..4bc29f4d3a7 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -30,6 +30,7 @@ #pragma once #include <boost/optional.hpp> +#include <functional> #include "mongo/db/auth/privilege.h" #include "mongo/db/auth/user_name.h" @@ -39,7 +40,6 @@ #include "mongo/db/query/plan_executor.h" #include "mongo/db/record_id.h" #include "mongo/db/repl/read_concern_level.h" -#include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 75b1e8d8d60..3e03837118f 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -317,7 +317,7 @@ void Cloner::copy(OperationContext* opCtx, QueryOption_Exhaust; { Lock::TempRelease tempRelease(opCtx->lockState()); - _conn->query(stdx::function<void(DBClientCursorBatchIterator&)>(f), + _conn->query(std::function<void(DBClientCursorBatchIterator&)>(f), from_collection, query, 0, diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index 0715354ba07..3039411660a 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -30,6 +30,7 @@ #pragma once #include <boost/optional.hpp> +#include <functional> #include <string> #include <vector> @@ -48,7 +49,6 @@ #include "mongo/db/write_concern.h" #include "mongo/rpc/op_msg.h" #include "mongo/rpc/reply_builder_interface.h" -#include "mongo/stdx/functional.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/string_map.h" diff --git a/src/mongo/db/commands/feature_compatibility_version.h b/src/mongo/db/commands/feature_compatibility_version.h index 475243d6233..c6f7a7f97d8 100644 --- a/src/mongo/db/commands/feature_compatibility_version.h +++ b/src/mongo/db/commands/feature_compatibility_version.h @@ -109,7 +109,7 @@ private: /** * Build update command. */ - typedef stdx::function<void(BSONObjBuilder)> UpdateBuilder; + typedef std::function<void(BSONObjBuilder)> UpdateBuilder; static void _runUpdateCommand(OperationContext* opCtx, UpdateBuilder callback); }; diff --git a/src/mongo/db/commands/fsync_locked.cpp b/src/mongo/db/commands/fsync_locked.cpp index 7100c06851e..322506aeb5a 100644 --- a/src/mongo/db/commands/fsync_locked.cpp +++ b/src/mongo/db/commands/fsync_locked.cpp @@ -27,18 +27,20 @@ * it in the license file. */ +#include <functional> + #include "mongo/db/commands/fsync_locked.h" namespace mongo { namespace { -stdx::function<bool()> lockedForWritingImpl; +std::function<bool()> lockedForWritingImpl; } // namespace bool lockedForWriting() { return lockedForWritingImpl(); } -void setLockedForWritingImpl(stdx::function<bool()> impl) { +void setLockedForWritingImpl(std::function<bool()> impl) { lockedForWritingImpl = std::move(impl); } } // namespace mongo diff --git a/src/mongo/db/commands/fsync_locked.h b/src/mongo/db/commands/fsync_locked.h index a84c03209de..b5d4ccffd09 100644 --- a/src/mongo/db/commands/fsync_locked.h +++ b/src/mongo/db/commands/fsync_locked.h @@ -29,7 +29,7 @@ #pragma once -#include "mongo/stdx/functional.h" +#include <functional> namespace mongo { /** @@ -41,6 +41,6 @@ bool lockedForWriting(); * Sets the implementation for lockedForWriting(). Should be done once during startup in a * MONGO_INITIALIZER. */ -void setLockedForWritingImpl(stdx::function<bool()> impl); +void setLockedForWritingImpl(std::function<bool()> impl); } // namespace mongo diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index 4e168c9efe8..60f3436deb6 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -475,7 +475,7 @@ public: // repeatedly release and re-acquire the collection readLock at regular intervals until // the failpoint is released. This is done in order to avoid deadlocks caused by the // pinned-cursor failpoints in this file (see SERVER-21997). - stdx::function<void()> dropAndReacquireReadLock = [&readLock, opCtx, this]() { + std::function<void()> dropAndReacquireReadLock = [&readLock, opCtx, this]() { // Make sure an interrupted operation does not prevent us from reacquiring the lock. UninterruptibleLockGuard noInterrupt(opCtx->lockState()); readLock.reset(); @@ -553,7 +553,7 @@ public: // the 'waitWithPinnedCursorDuringGetMoreBatch' failpoint is active, set the 'msg' field // of this operation's CurOp to signal that we've hit this point and then spin until the // failpoint is released. - stdx::function<void()> saveAndRestoreStateWithReadLockReacquisition = + std::function<void()> saveAndRestoreStateWithReadLockReacquisition = [exec, dropAndReacquireReadLock]() { exec->saveState(); dropAndReacquireReadLock(); diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp index 50196ec7aed..bd9b65ddaa0 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -97,9 +97,8 @@ LogicalSessionIdSet getMatchingSessionIdsFromTransactionTable(OperationContext* void forEachSessionWithCheckout( OperationContext* opCtx, LogicalSessionIdSet sessionIds, - stdx::function<bool(OperationContext* opCtx)> verifyTransactionParticipantFn, - stdx::function<void(DBDirectClient* client, LogicalSessionId sessionId)> - performModificationFn) { + std::function<bool(OperationContext* opCtx)> verifyTransactionParticipantFn, + std::function<void(DBDirectClient* client, LogicalSessionId sessionId)> performModificationFn) { // Construct a new operation context to check out the session with. auto clientForCheckout = opCtx->getServiceContext()->makeClient("setFCV-transaction-table-checkout"); diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index 623cffb0367..c47ca33f94c 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -33,6 +33,7 @@ #include "mongo/db/commands/user_management_commands.h" +#include <functional> #include <string> #include <vector> @@ -68,7 +69,6 @@ #include "mongo/db/service_context.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/write_ops/batched_command_response.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_set.h" #include "mongo/util/icu.h" @@ -246,7 +246,7 @@ Status queryAuthzDocument(OperationContext* opCtx, const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const stdx::function<void(const BSONObj&)>& resultProcessor) { + const std::function<void(const BSONObj&)>& resultProcessor) { try { DBDirectClient client(opCtx); client.query(resultProcessor, collectionName, query, &projection); diff --git a/src/mongo/db/concurrency/d_concurrency_test.cpp b/src/mongo/db/concurrency/d_concurrency_test.cpp index ddf60cc23a1..6172b1302ca 100644 --- a/src/mongo/db/concurrency/d_concurrency_test.cpp +++ b/src/mongo/db/concurrency/d_concurrency_test.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include <boost/optional/optional_io.hpp> +#include <functional> #include <string> #include <vector> @@ -41,7 +42,6 @@ #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/service_context_d_test_fixture.h" #include "mongo/db/storage/recovery_unit_noop.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/future.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" @@ -102,8 +102,8 @@ public: } stdx::future<void> runTaskAndKill(OperationContext* opCtx, - stdx::function<void()> fn, - stdx::function<void()> postKill = nullptr) { + std::function<void()> fn, + std::function<void()> postKill = nullptr) { auto task = stdx::packaged_task<void()>(fn); auto result = task.get_future(); stdx::thread taskThread{std::move(task)}; @@ -181,7 +181,7 @@ TEST_F(DConcurrencyTestFixture, ResourceMutex) { auto actual = step.fetchAndAdd(1); ASSERT_EQ(actual, n); } - void waitFor(stdx::function<bool()> cond) { + void waitFor(std::function<bool()> cond) { while (!cond()) sleepmillis(0); } diff --git a/src/mongo/db/dbmessage.h b/src/mongo/db/dbmessage.h index 69fdfd7375a..7828e2938f1 100644 --- a/src/mongo/db/dbmessage.h +++ b/src/mongo/db/dbmessage.h @@ -327,7 +327,7 @@ enum QueryOptions { * you want to pull it all down. Note: it is not allowed to not read all the data unless you * close the connection. - Use the query( stdx::function<void(const BSONObj&)> f, ... ) version of the connection's + Use the query( std::function<void(const BSONObj&)> f, ... ) version of the connection's query() method, and it will take care of all the details for you. */ diff --git a/src/mongo/db/ftdc/ftdc_server.h b/src/mongo/db/ftdc/ftdc_server.h index 3ce4b1dcf7c..e0512fe0f8b 100644 --- a/src/mongo/db/ftdc/ftdc_server.h +++ b/src/mongo/db/ftdc/ftdc_server.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <string> #include "mongo/bson/bsonobjbuilder.h" @@ -38,14 +39,13 @@ #include "mongo/db/ftdc/controller.h" #include "mongo/db/jsobj.h" #include "mongo/db/operation_context.h" -#include "mongo/stdx/functional.h" namespace mongo { /** * Function that allows FTDC server components to register their own collectors as needed. */ -using RegisterCollectorsFunction = stdx::function<void(FTDCController*)>; +using RegisterCollectorsFunction = std::function<void(FTDCController*)>; /** * An enum that decides whether FTDC will startup as part of startup or if its deferred to later. diff --git a/src/mongo/db/initialize_snmp.cpp b/src/mongo/db/initialize_snmp.cpp index 03190c9bbe8..c623b8c91f7 100644 --- a/src/mongo/db/initialize_snmp.cpp +++ b/src/mongo/db/initialize_snmp.cpp @@ -33,11 +33,11 @@ namespace mongo { namespace { bool initSet = false; -stdx::function<void()> snmpInitializer = [] {}; +std::function<void()> snmpInitializer = [] {}; } // namespace } // namespace mongo -void mongo::registerSNMPInitializer(stdx::function<void()> init) { +void mongo::registerSNMPInitializer(std::function<void()> init) { invariant(!initSet); snmpInitializer = std::move(init); initSet = true; diff --git a/src/mongo/db/initialize_snmp.h b/src/mongo/db/initialize_snmp.h index 4800de0ae9b..5fb85193b43 100644 --- a/src/mongo/db/initialize_snmp.h +++ b/src/mongo/db/initialize_snmp.h @@ -30,7 +30,7 @@ #pragma once -#include "mongo/stdx/functional.h" +#include <functional> namespace mongo { /** @@ -40,7 +40,7 @@ namespace mongo { * NOTE: This function may only be called once. * NOTE: This function is not multithread safe. */ -void registerSNMPInitializer(stdx::function<void()> init); +void registerSNMPInitializer(std::function<void()> init); /** * Performs initialization for SNMP enterprise modules, if present, otherwise does nothing. diff --git a/src/mongo/db/keys_collection_manager.h b/src/mongo/db/keys_collection_manager.h index 660d998f07f..c220e1ba990 100644 --- a/src/mongo/db/keys_collection_manager.h +++ b/src/mongo/db/keys_collection_manager.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <memory> #include "mongo/base/status_with.h" @@ -36,7 +37,6 @@ #include "mongo/db/keys_collection_cache.h" #include "mongo/db/keys_collection_document.h" #include "mongo/db/keys_collection_manager_gen.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/notification.h" @@ -120,7 +120,7 @@ private: */ class PeriodicRunner { public: - using RefreshFunc = stdx::function<StatusWith<KeysCollectionDocument>(OperationContext*)>; + using RefreshFunc = std::function<StatusWith<KeysCollectionDocument>(OperationContext*)>; /** * Preemptively inform the monitoring thread it needs to perform a refresh. Returns an diff --git a/src/mongo/db/kill_sessions_local.cpp b/src/mongo/db/kill_sessions_local.cpp index 8c217cb7e25..6f297922cc1 100644 --- a/src/mongo/db/kill_sessions_local.cpp +++ b/src/mongo/db/kill_sessions_local.cpp @@ -57,8 +57,8 @@ namespace { void killSessionsAction( OperationContext* opCtx, const SessionKiller::Matcher& matcher, - const stdx::function<bool(const ObservableSession&)>& filterFn, - const stdx::function<void(OperationContext*, const SessionToKill&)>& killSessionFn, + const std::function<bool(const ObservableSession&)>& filterFn, + const std::function<void(OperationContext*, const SessionToKill&)>& killSessionFn, ErrorCodes::Error reason = ErrorCodes::Interrupted) { const auto catalog = SessionCatalog::get(opCtx); diff --git a/src/mongo/db/matcher/expression.h b/src/mongo/db/matcher/expression.h index e3e3d652b4a..50a0aac4578 100644 --- a/src/mongo/db/matcher/expression.h +++ b/src/mongo/db/matcher/expression.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include "mongo/base/status.h" #include "mongo/bson/bsonobj.h" @@ -36,7 +37,6 @@ #include "mongo/db/matcher/match_details.h" #include "mongo/db/matcher/matchable.h" #include "mongo/db/pipeline/dependencies.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" @@ -332,7 +332,7 @@ protected: * in the specification of MatchExpression::getOptimizer(std::unique_ptr<MatchExpression>). */ using ExpressionOptimizerFunc = - stdx::function<std::unique_ptr<MatchExpression>(std::unique_ptr<MatchExpression>)>; + std::function<std::unique_ptr<MatchExpression>(std::unique_ptr<MatchExpression>)>; /** * Subclasses that are collation-aware must implement this method in order to capture changes diff --git a/src/mongo/db/matcher/expression_algo.h b/src/mongo/db/matcher/expression_algo.h index 0f97c19a8d6..835500a6948 100644 --- a/src/mongo/db/matcher/expression_algo.h +++ b/src/mongo/db/matcher/expression_algo.h @@ -29,11 +29,11 @@ #pragma once +#include <functional> #include <memory> #include <set> #include "mongo/base/string_data.h" -#include "mongo/stdx/functional.h" #include "mongo/util/string_map.h" namespace mongo { @@ -43,7 +43,7 @@ struct DepsTracker; namespace expression { -using NodeTraversalFunc = stdx::function<void(MatchExpression*, std::string)>; +using NodeTraversalFunc = std::function<void(MatchExpression*, std::string)>; /** * Returns true if the documents matched by 'lhs' are a subset of the documents matched by diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp index ede09820502..e65d6885227 100644 --- a/src/mongo/db/matcher/expression_parser.cpp +++ b/src/mongo/db/matcher/expression_parser.cpp @@ -127,12 +127,12 @@ Status parseSub(StringData name, MatchExpressionParser::AllowedFeatureSet allowedFeatures, DocumentParseLevel currentLevel); -stdx::function<StatusWithMatchExpression(StringData, - BSONElement, - const boost::intrusive_ptr<ExpressionContext>&, - const ExtensionsCallback*, - MatchExpressionParser::AllowedFeatureSet, - DocumentParseLevel)> +std::function<StatusWithMatchExpression(StringData, + BSONElement, + const boost::intrusive_ptr<ExpressionContext>&, + const ExtensionsCallback*, + MatchExpressionParser::AllowedFeatureSet, + DocumentParseLevel)> retrievePathlessParser(StringData name); StatusWithMatchExpression parseRegexElement(StringData name, BSONElement e) { @@ -1748,29 +1748,29 @@ StatusWithMatchExpression MatchExpressionParser::parse( namespace { // Maps from query operator string name to function. std::unique_ptr<StringMap< - stdx::function<StatusWithMatchExpression(StringData, - BSONElement, - const boost::intrusive_ptr<ExpressionContext>&, - const ExtensionsCallback*, - MatchExpressionParser::AllowedFeatureSet, - DocumentParseLevel)>>> + std::function<StatusWithMatchExpression(StringData, + BSONElement, + const boost::intrusive_ptr<ExpressionContext>&, + const ExtensionsCallback*, + MatchExpressionParser::AllowedFeatureSet, + DocumentParseLevel)>>> pathlessOperatorMap; MONGO_INITIALIZER(PathlessOperatorMap)(InitializerContext* context) { pathlessOperatorMap = stdx::make_unique<StringMap< - stdx::function<StatusWithMatchExpression(StringData, - BSONElement, - const boost::intrusive_ptr<ExpressionContext>&, - const ExtensionsCallback*, - MatchExpressionParser::AllowedFeatureSet, - DocumentParseLevel)>>>( + std::function<StatusWithMatchExpression(StringData, + BSONElement, + const boost::intrusive_ptr<ExpressionContext>&, + const ExtensionsCallback*, + MatchExpressionParser::AllowedFeatureSet, + DocumentParseLevel)>>>( StringMap< - stdx::function<StatusWithMatchExpression(StringData, - BSONElement, - const boost::intrusive_ptr<ExpressionContext>&, - const ExtensionsCallback*, - MatchExpressionParser::AllowedFeatureSet, - DocumentParseLevel)>>{ + std::function<StatusWithMatchExpression(StringData, + BSONElement, + const boost::intrusive_ptr<ExpressionContext>&, + const ExtensionsCallback*, + MatchExpressionParser::AllowedFeatureSet, + DocumentParseLevel)>>{ {"_internalSchemaAllowedProperties", &parseInternalSchemaAllowedProperties}, {"_internalSchemaCond", &parseInternalSchemaFixedArityArgument<InternalSchemaCondMatchExpression>}, @@ -1858,12 +1858,12 @@ MONGO_INITIALIZER(MatchExpressionParser)(InitializerContext* context) { * Returns the proper parser for the indicated pathless operator. Returns 'null' if 'name' * doesn't represent a known type. */ -stdx::function<StatusWithMatchExpression(StringData, - BSONElement, - const boost::intrusive_ptr<ExpressionContext>&, - const ExtensionsCallback*, - MatchExpressionParser::AllowedFeatureSet, - DocumentParseLevel)> +std::function<StatusWithMatchExpression(StringData, + BSONElement, + const boost::intrusive_ptr<ExpressionContext>&, + const ExtensionsCallback*, + MatchExpressionParser::AllowedFeatureSet, + DocumentParseLevel)> retrievePathlessParser(StringData name) { auto func = pathlessOperatorMap->find(name); if (func == pathlessOperatorMap->end()) { diff --git a/src/mongo/db/matcher/expression_parser.h b/src/mongo/db/matcher/expression_parser.h index 40aa8eb965a..b4048949055 100644 --- a/src/mongo/db/matcher/expression_parser.h +++ b/src/mongo/db/matcher/expression_parser.h @@ -29,6 +29,8 @@ #pragma once +#include <functional> + #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/db/matcher/expression.h" @@ -41,7 +43,6 @@ #include "mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h" #include "mongo/db/pipeline/expression.h" #include "mongo/db/pipeline/expression_context.h" -#include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_str_length.h b/src/mongo/db/matcher/schema/expression_internal_schema_str_length.h index 12ade1d8fc0..8721a8d718a 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_str_length.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_str_length.h @@ -29,15 +29,16 @@ #pragma once +#include <functional> + #include "mongo/base/string_data.h" #include "mongo/db/matcher/expression_leaf.h" -#include "mongo/stdx/functional.h" namespace mongo { class InternalSchemaStrLengthMatchExpression : public LeafMatchExpression { public: - using Validator = stdx::function<bool(int)>; + using Validator = std::function<bool(int)>; InternalSchemaStrLengthMatchExpression(MatchType type, StringData path, diff --git a/src/mongo/db/op_observer_registry_test.cpp b/src/mongo/db/op_observer_registry_test.cpp index a1146ac593d..b77de91b116 100644 --- a/src/mongo/db/op_observer_registry_test.cpp +++ b/src/mongo/db/op_observer_registry_test.cpp @@ -109,7 +109,7 @@ struct OpObserverRegistryTest : public unittest::Test { * The 'op' function calls an observer method on the registry that returns an OpTime. * The method checks that the registry correctly returns only the first observer's `OpTime`. */ - void checkConsistentOpTime(stdx::function<repl::OpTime()> op) { + void checkConsistentOpTime(std::function<repl::OpTime()> op) { const repl::OpTime myTime(Timestamp(1, 1), 1); ASSERT(op() == repl::OpTime()); observer1->opTime = myTime; @@ -124,7 +124,7 @@ struct OpObserverRegistryTest : public unittest::Test { * The 'op' function calls an observer method on the registry that returns an OpTime. * The method checks that the registry invariants if the observers return multiple times. */ - void checkInconsistentOpTime(stdx::function<repl::OpTime()> op) { + void checkInconsistentOpTime(std::function<repl::OpTime()> op) { observer1->opTime = repl::OpTime(Timestamp(1, 1), 1); observer2->opTime = repl::OpTime(Timestamp(2, 2), 2); op(); // This will invariant because of inconsistent timestamps: for death test. diff --git a/src/mongo/db/operation_context_test.cpp b/src/mongo/db/operation_context_test.cpp index 289876d9df2..81a24cb65e9 100644 --- a/src/mongo/db/operation_context_test.cpp +++ b/src/mongo/db/operation_context_test.cpp @@ -646,8 +646,8 @@ TEST_F(OperationDeadlineTests, DuringWaitMaxTimeExpirationDominatesUntilExpirati class ThreadedOperationDeadlineTests : public OperationDeadlineTests { public: - using CvPred = stdx::function<bool()>; - using WaitFn = stdx::function<bool( + using CvPred = std::function<bool()>; + using WaitFn = std::function<bool( OperationContext*, stdx::condition_variable&, stdx::unique_lock<stdx::mutex>&, CvPred)>; struct WaitTestState { diff --git a/src/mongo/db/pipeline/accumulator.h b/src/mongo/db/pipeline/accumulator.h index 801c356020f..1a2986cb374 100644 --- a/src/mongo/db/pipeline/accumulator.h +++ b/src/mongo/db/pipeline/accumulator.h @@ -33,6 +33,7 @@ #include <boost/intrusive_ptr.hpp> #include <boost/optional.hpp> +#include <functional> #include <vector> #include "mongo/base/init.h" @@ -41,7 +42,6 @@ #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/pipeline/value_comparator.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/unordered_set.h" #include "mongo/util/summation.h" diff --git a/src/mongo/db/pipeline/document_path_support.cpp b/src/mongo/db/pipeline/document_path_support.cpp index d89f122463c..3da0790b574 100644 --- a/src/mongo/db/pipeline/document_path_support.cpp +++ b/src/mongo/db/pipeline/document_path_support.cpp @@ -49,8 +49,7 @@ namespace { * If 'value' is an array, invokes 'callback' once on each element of 'value'. Otherwise, if 'value' * is not missing, invokes 'callback' on 'value' itself. */ -void invokeCallbackOnTrailingValue(const Value& value, - stdx::function<void(const Value&)> callback) { +void invokeCallbackOnTrailingValue(const Value& value, std::function<void(const Value&)> callback) { if (value.isArray()) { for (auto&& finalValue : value.getArray()) { if (!finalValue.missing()) { @@ -65,7 +64,7 @@ void invokeCallbackOnTrailingValue(const Value& value, void visitAllValuesAtPathHelper(Document doc, const FieldPath& path, size_t fieldPathIndex, - stdx::function<void(const Value&)> callback) { + std::function<void(const Value&)> callback) { invariant(path.getPathLength() > 0 && fieldPathIndex < path.getPathLength()); // The first field in the path must be treated as a field name, even if it is numeric as in @@ -116,7 +115,7 @@ void visitAllValuesAtPathHelper(Document doc, void visitAllValuesAtPath(const Document& doc, const FieldPath& path, - stdx::function<void(const Value&)> callback) { + std::function<void(const Value&)> callback) { visitAllValuesAtPathHelper(doc, path, 0, callback); } diff --git a/src/mongo/db/pipeline/document_path_support.h b/src/mongo/db/pipeline/document_path_support.h index 7b035ccb3c2..e35ea59e441 100644 --- a/src/mongo/db/pipeline/document_path_support.h +++ b/src/mongo/db/pipeline/document_path_support.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <vector> #include "mongo/db/pipeline/document.h" @@ -36,7 +37,6 @@ #include "mongo/db/pipeline/field_path.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/pipeline/value_comparator.h" -#include "mongo/stdx/functional.h" namespace mongo { namespace document_path_support { @@ -50,7 +50,7 @@ namespace document_path_support { */ void visitAllValuesAtPath(const Document& doc, const FieldPath& path, - stdx::function<void(const Value&)> callback); + std::function<void(const Value&)> callback); /** * Returns the element at 'path' in 'doc', or a missing Value if the path does not fully exist. diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index 84d724231fc..6d8547d3da2 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -33,6 +33,7 @@ #include <boost/intrusive_ptr.hpp> #include <boost/optional.hpp> +#include <functional> #include <list> #include <memory> #include <string> @@ -54,7 +55,6 @@ #include "mongo/db/pipeline/stage_constraints.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/query/explain_options.h" -#include "mongo/stdx/functional.h" #include "mongo/util/intrusive_counter.h" namespace mongo { @@ -129,7 +129,7 @@ class Document; class DocumentSource : public RefCountable { public: - using Parser = stdx::function<std::list<boost::intrusive_ptr<DocumentSource>>( + using Parser = std::function<std::list<boost::intrusive_ptr<DocumentSource>>( BSONElement, const boost::intrusive_ptr<ExpressionContext>&)>; using ChangeStreamRequirement = StageConstraints::ChangeStreamRequirement; diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h index 706d5bde44a..3ee13d4ea5e 100644 --- a/src/mongo/db/pipeline/expression.h +++ b/src/mongo/db/pipeline/expression.h @@ -33,6 +33,7 @@ #include <algorithm> #include <boost/intrusive_ptr.hpp> +#include <functional> #include <map> #include <pcre.h> #include <string> @@ -49,7 +50,6 @@ #include "mongo/db/pipeline/variables.h" #include "mongo/db/query/datetime/date_time_support.h" #include "mongo/db/server_options.h" -#include "mongo/stdx/functional.h" #include "mongo/util/intrusive_counter.h" #include "mongo/util/str.h" @@ -91,7 +91,7 @@ class DocumentSource; class Expression : public RefCountable { public: - using Parser = stdx::function<boost::intrusive_ptr<Expression>( + using Parser = std::function<boost::intrusive_ptr<Expression>( const boost::intrusive_ptr<ExpressionContext>&, BSONElement, const VariablesParseState&)>; /** diff --git a/src/mongo/db/pipeline/granularity_rounder.h b/src/mongo/db/pipeline/granularity_rounder.h index e88d159176d..f96c6f4662c 100644 --- a/src/mongo/db/pipeline/granularity_rounder.h +++ b/src/mongo/db/pipeline/granularity_rounder.h @@ -29,13 +29,13 @@ #pragma once +#include <functional> #include <vector> #include "mongo/base/init.h" #include "mongo/db/jsobj.h" #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/value.h" -#include "mongo/stdx/functional.h" #include "mongo/util/intrusive_counter.h" namespace mongo { @@ -75,7 +75,7 @@ namespace mongo { */ class GranularityRounder : public RefCountable { public: - using Rounder = stdx::function<boost::intrusive_ptr<GranularityRounder>( + using Rounder = std::function<boost::intrusive_ptr<GranularityRounder>( const boost::intrusive_ptr<ExpressionContext>&)>; /** diff --git a/src/mongo/db/pipeline/lite_parsed_document_source.h b/src/mongo/db/pipeline/lite_parsed_document_source.h index 7fb21cb37bf..af311de66fc 100644 --- a/src/mongo/db/pipeline/lite_parsed_document_source.h +++ b/src/mongo/db/pipeline/lite_parsed_document_source.h @@ -30,6 +30,7 @@ #pragma once #include <boost/optional.hpp> +#include <functional> #include <memory> #include <vector> @@ -37,7 +38,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/db/pipeline/aggregation_request.h" #include "mongo/db/repl/read_concern_args.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_set.h" @@ -61,7 +61,7 @@ public: * which this aggregation is being performed, and the BSONElement will be the element whose * field name is the name of this stage (e.g. the first and only element in {$limit: 1}). */ - using Parser = stdx::function<std::unique_ptr<LiteParsedDocumentSource>( + using Parser = std::function<std::unique_ptr<LiteParsedDocumentSource>( const AggregationRequest&, const BSONElement&)>; /** diff --git a/src/mongo/db/pipeline/lookup_set_cache.h b/src/mongo/db/pipeline/lookup_set_cache.h index 0a68a65d086..11c28852f34 100644 --- a/src/mongo/db/pipeline/lookup_set_cache.h +++ b/src/mongo/db/pipeline/lookup_set_cache.h @@ -36,13 +36,13 @@ #include <boost/multi_index/sequenced_index.hpp> #include <boost/multi_index_container.hpp> #include <boost/optional.hpp> +#include <functional> #include <vector> #include "mongo/base/string_data_comparator_interface.h" #include "mongo/db/pipeline/document.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/pipeline/value_comparator.h" -#include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp index 439d4d9ab88..23484931890 100644 --- a/src/mongo/db/pipeline/pipeline.cpp +++ b/src/mongo/db/pipeline/pipeline.cpp @@ -684,7 +684,7 @@ boost::intrusive_ptr<DocumentSource> Pipeline::popFrontWithName(StringData targe } boost::intrusive_ptr<DocumentSource> Pipeline::popFrontWithNameAndCriteria( - StringData targetStageName, stdx::function<bool(const DocumentSource* const)> predicate) { + StringData targetStageName, std::function<bool(const DocumentSource* const)> predicate) { if (_sources.empty() || _sources.front()->getSourceName() != targetStageName) { return nullptr; } diff --git a/src/mongo/db/pipeline/pipeline.h b/src/mongo/db/pipeline/pipeline.h index 06c35e36c1c..75249314225 100644 --- a/src/mongo/db/pipeline/pipeline.h +++ b/src/mongo/db/pipeline/pipeline.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <list> #include <vector> @@ -42,7 +43,6 @@ #include "mongo/db/query/query_knobs_gen.h" #include "mongo/executor/task_executor.h" #include "mongo/s/query/async_results_merger_params_gen.h" -#include "mongo/stdx/functional.h" #include "mongo/util/intrusive_counter.h" #include "mongo/util/timer.h" @@ -315,7 +315,7 @@ public: * stage. Returns nullptr if there is no first stage which meets these criteria. */ boost::intrusive_ptr<DocumentSource> popFrontWithNameAndCriteria( - StringData targetStageName, stdx::function<bool(const DocumentSource* const)> predicate); + StringData targetStageName, std::function<bool(const DocumentSource* const)> predicate); /** * PipelineD is a "sister" class that has additional functionality for the Pipeline. It exists diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp index 7485d1a7260..10464c58641 100644 --- a/src/mongo/db/query/find.cpp +++ b/src/mongo/db/query/find.cpp @@ -353,7 +353,7 @@ Message getMore(OperationContext* opCtx, *isCursorAuthorized = true; // Only used by the failpoints. - stdx::function<void()> dropAndReaquireReadLock = [&] { + std::function<void()> dropAndReaquireReadLock = [&] { // Make sure an interrupted operation does not prevent us from reacquiring the lock. UninterruptibleLockGuard noInterrupt(opCtx->lockState()); diff --git a/src/mongo/db/query/mock_yield_policies.h b/src/mongo/db/query/mock_yield_policies.h index bc4a755cf99..68d537f34a3 100644 --- a/src/mongo/db/query/mock_yield_policies.h +++ b/src/mongo/db/query/mock_yield_policies.h @@ -50,7 +50,7 @@ public: return true; } - Status yieldOrInterrupt(stdx::function<void()> whileYieldingFn) override { + Status yieldOrInterrupt(std::function<void()> whileYieldingFn) override { return {ErrorCodes::ExceededTimeLimit, "Using AlwaysTimeOutYieldPolicy"}; } }; @@ -71,7 +71,7 @@ public: return true; } - Status yieldOrInterrupt(stdx::function<void()> whileYieldingFn) override { + Status yieldOrInterrupt(std::function<void()> whileYieldingFn) override { return {ErrorCodes::QueryPlanKilled, "Using AlwaysPlanKilledYieldPolicy"}; } }; diff --git a/src/mongo/db/query/plan_cache_indexability.h b/src/mongo/db/query/plan_cache_indexability.h index 5c78dabd3d7..426cec2fb25 100644 --- a/src/mongo/db/query/plan_cache_indexability.h +++ b/src/mongo/db/query/plan_cache_indexability.h @@ -29,10 +29,10 @@ #pragma once +#include <functional> #include <vector> #include "mongo/db/exec/projection_exec_agg.h" -#include "mongo/stdx/functional.h" #include "mongo/util/string_map.h" namespace mongo { @@ -43,7 +43,7 @@ class CompositeIndexabilityDiscriminator; class MatchExpression; struct CoreIndexInfo; -using IndexabilityDiscriminator = stdx::function<bool(const MatchExpression* me)>; +using IndexabilityDiscriminator = std::function<bool(const MatchExpression* me)>; using IndexabilityDiscriminators = std::vector<IndexabilityDiscriminator>; using IndexToDiscriminatorMap = StringMap<CompositeIndexabilityDiscriminator>; diff --git a/src/mongo/db/query/plan_yield_policy.cpp b/src/mongo/db/query/plan_yield_policy.cpp index b86d3f437f4..43590f27d7d 100644 --- a/src/mongo/db/query/plan_yield_policy.cpp +++ b/src/mongo/db/query/plan_yield_policy.cpp @@ -81,7 +81,7 @@ void PlanYieldPolicy::resetTimer() { _elapsedTracker.resetLastTime(); } -Status PlanYieldPolicy::yieldOrInterrupt(stdx::function<void()> whileYieldingFn) { +Status PlanYieldPolicy::yieldOrInterrupt(std::function<void()> whileYieldingFn) { invariant(_planYielding); if (_policy == PlanExecutor::INTERRUPT_ONLY) { @@ -151,7 +151,7 @@ MONGO_FAIL_POINT_DEFINE(setYieldAllLocksWait); } // namespace void PlanYieldPolicy::_yieldAllLocks(OperationContext* opCtx, - stdx::function<void()> whileYieldingFn, + std::function<void()> whileYieldingFn, const NamespaceString& planExecNS) { // Things have to happen here in a specific order: // * Release lock mgr locks diff --git a/src/mongo/db/query/plan_yield_policy.h b/src/mongo/db/query/plan_yield_policy.h index 0d2281c851b..512bc908dcc 100644 --- a/src/mongo/db/query/plan_yield_policy.h +++ b/src/mongo/db/query/plan_yield_policy.h @@ -29,9 +29,10 @@ #pragma once +#include <functional> + #include "mongo/db/catalog/collection.h" #include "mongo/db/query/plan_executor.h" -#include "mongo/stdx/functional.h" #include "mongo/util/elapsed_tracker.h" namespace mongo { @@ -76,7 +77,7 @@ public: * Calls 'whileYieldingFn' after relinquishing locks and before reacquiring the locks that have * been relinquished. */ - virtual Status yieldOrInterrupt(stdx::function<void()> whileYieldingFn = nullptr); + virtual Status yieldOrInterrupt(std::function<void()> whileYieldingFn = nullptr); /** * All calls to shouldYieldOrInterrupt() will return true until the next call to @@ -153,7 +154,7 @@ private: * The whileYieldingFn will be executed after unlocking the locks and before re-acquiring them. */ void _yieldAllLocks(OperationContext* opCtx, - stdx::function<void()> whileYieldingFn, + std::function<void()> whileYieldingFn, const NamespaceString& planExecNS); }; diff --git a/src/mongo/db/repair_database.cpp b/src/mongo/db/repair_database.cpp index 193d5221eb5..61c90a722e5 100644 --- a/src/mongo/db/repair_database.cpp +++ b/src/mongo/db/repair_database.cpp @@ -61,7 +61,7 @@ namespace mongo { StatusWith<IndexNameObjs> getIndexNameObjs(OperationContext* opCtx, CollectionCatalogEntry* cce, - stdx::function<bool(const std::string&)> filter) { + std::function<bool(const std::string&)> filter) { IndexNameObjs ret; std::vector<std::string>& indexNames = ret.first; std::vector<BSONObj>& indexSpecs = ret.second; diff --git a/src/mongo/db/repair_database.h b/src/mongo/db/repair_database.h index 25b518b6ac7..b8543e0c973 100644 --- a/src/mongo/db/repair_database.h +++ b/src/mongo/db/repair_database.h @@ -29,10 +29,10 @@ #pragma once +#include <functional> #include <string> #include "mongo/bson/bsonobj.h" -#include "mongo/stdx/functional.h" namespace mongo { class CollectionCatalogEntry; @@ -52,7 +52,7 @@ typedef std::pair<std::vector<std::string>, std::vector<BSONObj>> IndexNameObjs; */ StatusWith<IndexNameObjs> getIndexNameObjs(OperationContext* opCtx, CollectionCatalogEntry* cce, - stdx::function<bool(const std::string&)> filter = + std::function<bool(const std::string&)> filter = [](const std::string& indexName) { return true; }); /** diff --git a/src/mongo/db/repair_database_and_check_version.cpp b/src/mongo/db/repair_database_and_check_version.cpp index 4c0203f06fd..2c56a5877dd 100644 --- a/src/mongo/db/repair_database_and_check_version.cpp +++ b/src/mongo/db/repair_database_and_check_version.cpp @@ -33,6 +33,8 @@ #include "repair_database_and_check_version.h" +#include <functional> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/collection_catalog_entry.h" #include "mongo/db/catalog/create_collection.h" @@ -52,7 +54,6 @@ #include "mongo/db/repl_set_member_in_standalone_mode.h" #include "mongo/db/server_options.h" #include "mongo/db/storage/storage_repair_observer.h" -#include "mongo/stdx/functional.h" #include "mongo/util/exit.h" #include "mongo/util/fail_point.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/repl/abstract_oplog_fetcher.h b/src/mongo/db/repl/abstract_oplog_fetcher.h index 11d59fd82a8..81497bf1258 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher.h +++ b/src/mongo/db/repl/abstract_oplog_fetcher.h @@ -29,12 +29,13 @@ #pragma once +#include <functional> + #include "mongo/base/status_with.h" #include "mongo/client/fetcher.h" #include "mongo/db/namespace_string.h" #include "mongo/db/repl/abstract_async_component.h" #include "mongo/db/repl/optime_with.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { @@ -64,7 +65,7 @@ public: * This function will be called 0 times if startup() fails and at most once after startup() * returns success. */ - using OnShutdownCallbackFn = stdx::function<void(const Status& shutdownStatus)>; + using OnShutdownCallbackFn = std::function<void(const Status& shutdownStatus)>; /** * Invariants if validation fails on any of the provided arguments. diff --git a/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp b/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp index ec3357ee9e8..6fe6ed75665 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp @@ -158,7 +158,7 @@ TEST_F(AbstractOplogFetcherTest, StartupReturnsOperationFailedIfExecutorFailsToS taskExecutorMock.shouldFailScheduleWorkRequest = []() { return true; }; MockOplogFetcher oplogFetcher( - &taskExecutorMock, lastFetched, source, nss, 0, stdx::ref(shutdownState)); + &taskExecutorMock, lastFetched, source, nss, 0, std::ref(shutdownState)); ASSERT_EQUALS(ErrorCodes::OperationFailed, oplogFetcher.startup()); } @@ -171,7 +171,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherReturnsOperationFailedIfExecutorFai [](const executor::RemoteCommandRequestOnAny&) { return true; }; MockOplogFetcher oplogFetcher( - &taskExecutorMock, lastFetched, source, nss, 0, stdx::ref(shutdownState)); + &taskExecutorMock, lastFetched, source, nss, 0, std::ref(shutdownState)); ASSERT_FALSE(oplogFetcher.isActive()); ASSERT_OK(oplogFetcher.startup()); @@ -191,7 +191,7 @@ TEST_F(AbstractOplogFetcherTest, ShuttingExecutorDownAfterStartupStopsTheOplogFe taskExecutorMock.shouldDeferScheduleWorkRequestByOneSecond = []() { return true; }; MockOplogFetcher oplogFetcher( - &taskExecutorMock, lastFetched, source, nss, 0, stdx::ref(shutdownState)); + &taskExecutorMock, lastFetched, source, nss, 0, std::ref(shutdownState)); ASSERT_FALSE(oplogFetcher.isActive()); ASSERT_OK(oplogFetcher.startup()); @@ -211,7 +211,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherReturnsCallbackCanceledIfShutdownAf taskExecutorMock.shouldDeferScheduleWorkRequestByOneSecond = []() { return true; }; MockOplogFetcher oplogFetcher( - &taskExecutorMock, lastFetched, source, nss, 0, stdx::ref(shutdownState)); + &taskExecutorMock, lastFetched, source, nss, 0, std::ref(shutdownState)); ASSERT_FALSE(oplogFetcher.isActive()); ASSERT_OK(oplogFetcher.startup()); @@ -261,7 +261,7 @@ TEST_F(AbstractOplogFetcherTest, source, nss, maxFetcherRestarts, - stdx::ref(*shutdownState)); + std::ref(*shutdownState)); ON_BLOCK_EXIT([this] { getExecutor().shutdown(); }); @@ -293,7 +293,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherStopsRestartingFetcherIfRestartLimi source, nss, maxFetcherRestarts, - stdx::ref(*shutdownState)); + std::ref(*shutdownState)); ON_BLOCK_EXIT([this] { getExecutor().shutdown(); }); @@ -329,7 +329,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherResetsRestartCounterOnSuccessfulFet source, nss, maxFetcherRestarts, - stdx::ref(*shutdownState)); + std::ref(*shutdownState)); ON_BLOCK_EXIT([this] { getExecutor().shutdown(); }); ASSERT_OK(oplogFetcher.startup()); @@ -365,7 +365,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherResetsRestartCounterOnSuccessfulFet class TaskExecutorWithFailureInScheduleRemoteCommand : public unittest::TaskExecutorProxy { public: - using ShouldFailRequestFn = stdx::function<bool(const executor::RemoteCommandRequest&)>; + using ShouldFailRequestFn = std::function<bool(const executor::RemoteCommandRequest&)>; TaskExecutorWithFailureInScheduleRemoteCommand(executor::TaskExecutor* executor, ShouldFailRequestFn shouldFailRequest) @@ -399,7 +399,7 @@ TEST_F(AbstractOplogFetcherTest, source, nss, maxFetcherRestarts, - stdx::ref(*shutdownState)); + std::ref(*shutdownState)); ON_BLOCK_EXIT([this] { getExecutor().shutdown(); }); ASSERT_OK(oplogFetcher.startup()); @@ -430,7 +430,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherTimesOutCorrectlyOnInitialFindReque source, nss, maxFetcherRestarts, - stdx::ref(*shutdownState)); + std::ref(*shutdownState)); // Set a finite network timeout for the initial find request. auto initialFindMaxTime = Milliseconds(10000); @@ -468,7 +468,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherTimesOutCorrectlyOnRetriedFindReque source, nss, maxFetcherRestarts, - stdx::ref(*shutdownState)); + std::ref(*shutdownState)); // Set finite network timeouts for the initial and retried find requests. auto initialFindMaxTime = Milliseconds(10000); diff --git a/src/mongo/db/repl/base_cloner.h b/src/mongo/db/repl/base_cloner.h index 43a1f5365ad..0397d103bc2 100644 --- a/src/mongo/db/repl/base_cloner.h +++ b/src/mongo/db/repl/base_cloner.h @@ -29,8 +29,9 @@ #pragma once +#include <functional> + #include "mongo/base/status.h" -#include "mongo/stdx/functional.h" namespace mongo { namespace repl { @@ -45,7 +46,7 @@ public: /** * Callback function to report final status of cloning. */ - using CallbackFn = stdx::function<void(const Status&)>; + using CallbackFn = std::function<void(const Status&)>; virtual ~BaseCloner() {} diff --git a/src/mongo/db/repl/bgsync.h b/src/mongo/db/repl/bgsync.h index 7e64afae171..79528f0ae88 100644 --- a/src/mongo/db/repl/bgsync.h +++ b/src/mongo/db/repl/bgsync.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <memory> #include "mongo/base/status_with.h" @@ -42,7 +43,6 @@ #include "mongo/db/repl/rollback_impl.h" #include "mongo/db/repl/sync_source_resolver.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/net/hostandport.h" diff --git a/src/mongo/db/repl/callback_completion_guard.h b/src/mongo/db/repl/callback_completion_guard.h index 9eb4020db7d..4effb49c1f2 100644 --- a/src/mongo/db/repl/callback_completion_guard.h +++ b/src/mongo/db/repl/callback_completion_guard.h @@ -31,8 +31,8 @@ #pragma once #include <boost/optional.hpp> +#include <functional> -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" @@ -52,12 +52,12 @@ public: * Function to cancel remaining work in caller after setting '_result'. * This function must be called while holding a lock on the caller's mutex. */ - using CancelRemainingWorkInLockFn = stdx::function<void()>; + using CancelRemainingWorkInLockFn = std::function<void()>; /** * Callback function to pass result to caller at destruction. */ - typedef stdx::function<void(const Result& result)> OnCompletionFn; + typedef std::function<void(const Result& result)> OnCompletionFn; /** * Constructor for this completion guard. diff --git a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp index 36807a63c2e..fceb6919e6b 100644 --- a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp +++ b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <functional> + #include "mongo/base/status.h" #include "mongo/db/jsobj.h" #include "mongo/db/repl/check_quorum_for_config_change.h" @@ -40,7 +42,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" #include "mongo/rpc/metadata/repl_set_metadata.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/stdx/unordered_set.h" diff --git a/src/mongo/db/repl/collection_cloner.h b/src/mongo/db/repl/collection_cloner.h index 33ca6ef6e71..817925ed765 100644 --- a/src/mongo/db/repl/collection_cloner.h +++ b/src/mongo/db/repl/collection_cloner.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <memory> #include <string> #include <vector> @@ -48,7 +49,6 @@ #include "mongo/db/repl/task_runner.h" #include "mongo/executor/task_executor.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/net/hostandport.h" @@ -100,7 +100,7 @@ public: * * Used for testing only. */ - using CreateClientFn = stdx::function<std::unique_ptr<DBClientConnection>()>; + using CreateClientFn = std::function<std::unique_ptr<DBClientConnection>()>; /** * Creates CollectionCloner task in inactive state. Use start() to activate cloner. diff --git a/src/mongo/db/repl/collection_cloner_test.cpp b/src/mongo/db/repl/collection_cloner_test.cpp index 20c4eb00ae3..71c2aca517c 100644 --- a/src/mongo/db/repl/collection_cloner_test.cpp +++ b/src/mongo/db/repl/collection_cloner_test.cpp @@ -79,7 +79,7 @@ public: } using MockDBClientConnection::query; // This avoids warnings from -Woverloaded-virtual - unsigned long long query(stdx::function<void(mongo::DBClientCursorBatchIterator&)> f, + unsigned long long query(std::function<void(mongo::DBClientCursorBatchIterator&)> f, const NamespaceStringOrUUID& nsOrUuid, mongo::Query query, const mongo::BSONObj* fieldsToReturn, @@ -502,7 +502,7 @@ TEST_F(CollectionClonerTest, CollectionClonerReturnsBadValueOnNegativeDocumentCo class TaskExecutorWithFailureInScheduleRemoteCommand : public unittest::TaskExecutorProxy { public: - using ShouldFailRequestFn = stdx::function<bool(const executor::RemoteCommandRequest&)>; + using ShouldFailRequestFn = std::function<bool(const executor::RemoteCommandRequest&)>; TaskExecutorWithFailureInScheduleRemoteCommand(executor::TaskExecutor* executor, ShouldFailRequestFn shouldFailRequest) diff --git a/src/mongo/db/repl/data_replicator_external_state_mock.h b/src/mongo/db/repl/data_replicator_external_state_mock.h index feae8935dff..dfce2ecc5fb 100644 --- a/src/mongo/db/repl/data_replicator_external_state_mock.h +++ b/src/mongo/db/repl/data_replicator_external_state_mock.h @@ -88,7 +88,7 @@ public: bool shouldStopFetchingResult = false; // Override to change multiApply behavior. - using MultiApplyFn = stdx::function<StatusWith<OpTime>( + using MultiApplyFn = std::function<StatusWith<OpTime>( OperationContext*, MultiApplier::Operations, OplogApplier::Observer*)>; MultiApplyFn multiApplyFn; diff --git a/src/mongo/db/repl/database_cloner.cpp b/src/mongo/db/repl/database_cloner.cpp index 267428f3831..ebcef5ec93d 100644 --- a/src/mongo/db/repl/database_cloner.cpp +++ b/src/mongo/db/repl/database_cloner.cpp @@ -34,6 +34,7 @@ #include "mongo/db/repl/database_cloner.h" #include <algorithm> +#include <functional> #include <iterator> #include <set> @@ -42,7 +43,6 @@ #include "mongo/db/commands/list_collections_filter.h" #include "mongo/db/repl/repl_server_parameters_gen.h" #include "mongo/db/repl/storage_interface.h" -#include "mongo/stdx/functional.h" #include "mongo/util/assert_util.h" #include "mongo/util/destructor_guard.h" #include "mongo/util/fail_point_service.h" diff --git a/src/mongo/db/repl/database_cloner.h b/src/mongo/db/repl/database_cloner.h index 94b559d8278..e2790956089 100644 --- a/src/mongo/db/repl/database_cloner.h +++ b/src/mongo/db/repl/database_cloner.h @@ -80,7 +80,7 @@ public: * Returns true if the collection described by the info object should be cloned. * Returns false if the collection should be ignored. */ - using ListCollectionsPredicateFn = stdx::function<bool(const BSONObj&)>; + using ListCollectionsPredicateFn = std::function<bool(const BSONObj&)>; /** * Callback function to report progress of collection cloning. Arguments are: @@ -89,14 +89,14 @@ public: * * Called exactly once for every collection cloner started by the the database cloner. */ - using CollectionCallbackFn = stdx::function<void(const Status&, const NamespaceString&)>; + using CollectionCallbackFn = std::function<void(const Status&, const NamespaceString&)>; /** * Type of function to start a collection cloner. */ - using StartCollectionClonerFn = stdx::function<Status(CollectionCloner&)>; + using StartCollectionClonerFn = std::function<Status(CollectionCloner&)>; - using ScheduleDbWorkFn = stdx::function<StatusWith<executor::TaskExecutor::CallbackHandle>( + using ScheduleDbWorkFn = std::function<StatusWith<executor::TaskExecutor::CallbackHandle>( executor::TaskExecutor::CallbackFn)>; /** diff --git a/src/mongo/db/repl/database_cloner_test.cpp b/src/mongo/db/repl/database_cloner_test.cpp index 66948a482ef..ba651b672d3 100644 --- a/src/mongo/db/repl/database_cloner_test.cpp +++ b/src/mongo/db/repl/database_cloner_test.cpp @@ -227,7 +227,7 @@ TEST_F(DatabaseClonerTest, DatabaseClonerTransitionsToCompleteIfShutdownBeforeSt class TaskExecutorWithFailureInScheduleRemoteCommand : public unittest::TaskExecutorProxy { public: - using ShouldFailRequestFn = stdx::function<bool(const executor::RemoteCommandRequest&)>; + using ShouldFailRequestFn = std::function<bool(const executor::RemoteCommandRequest&)>; TaskExecutorWithFailureInScheduleRemoteCommand(executor::TaskExecutor* executor, ShouldFailRequestFn shouldFailRequest) diff --git a/src/mongo/db/repl/databases_cloner.cpp b/src/mongo/db/repl/databases_cloner.cpp index 9639734e645..2823cebcc69 100644 --- a/src/mongo/db/repl/databases_cloner.cpp +++ b/src/mongo/db/repl/databases_cloner.cpp @@ -34,6 +34,7 @@ #include "mongo/db/repl/databases_cloner.h" #include <algorithm> +#include <functional> #include <iterator> #include <set> @@ -43,7 +44,6 @@ #include "mongo/db/repl/databases_cloner_gen.h" #include "mongo/db/repl/storage_interface.h" #include "mongo/rpc/get_status_from_command_result.h" -#include "mongo/stdx/functional.h" #include "mongo/util/assert_util.h" #include "mongo/util/destructor_guard.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/repl/databases_cloner.h b/src/mongo/db/repl/databases_cloner.h index 8d94afe26fc..890c6c2a7e1 100644 --- a/src/mongo/db/repl/databases_cloner.h +++ b/src/mongo/db/repl/databases_cloner.h @@ -64,10 +64,10 @@ public: void append(BSONObjBuilder* builder) const; }; - using IncludeDbFilterFn = stdx::function<bool(const BSONObj& dbInfo)>; - using OnFinishFn = stdx::function<void(const Status&)>; + using IncludeDbFilterFn = std::function<bool(const BSONObj& dbInfo)>; + using OnFinishFn = std::function<void(const Status&)>; using StartCollectionClonerFn = DatabaseCloner::StartCollectionClonerFn; - using ScheduleDbWorkFn = stdx::function<StatusWith<executor::TaskExecutor::CallbackHandle>( + using ScheduleDbWorkFn = std::function<StatusWith<executor::TaskExecutor::CallbackHandle>( executor::TaskExecutor::CallbackFn)>; DatabasesCloner(StorageInterface* si, diff --git a/src/mongo/db/repl/databases_cloner_test.cpp b/src/mongo/db/repl/databases_cloner_test.cpp index c13154b179a..46cb0a649c3 100644 --- a/src/mongo/db/repl/databases_cloner_test.cpp +++ b/src/mongo/db/repl/databases_cloner_test.cpp @@ -767,7 +767,7 @@ TEST_F(DBsClonerTest, FailsOnListCollectionsOnFirstOfTwoDatabases) { class TaskExecutorWithFailureInScheduleRemoteCommand : public unittest::TaskExecutorProxy { public: - using ShouldFailRequestFn = stdx::function<bool(const executor::RemoteCommandRequest&)>; + using ShouldFailRequestFn = std::function<bool(const executor::RemoteCommandRequest&)>; TaskExecutorWithFailureInScheduleRemoteCommand(executor::TaskExecutor* executor, ShouldFailRequestFn shouldFailRequest) diff --git a/src/mongo/db/repl/initial_syncer.h b/src/mongo/db/repl/initial_syncer.h index 5aea265e90e..265b383acaf 100644 --- a/src/mongo/db/repl/initial_syncer.h +++ b/src/mongo/db/repl/initial_syncer.h @@ -31,6 +31,7 @@ #pragma once #include <cstdint> +#include <functional> #include <iosfwd> #include <memory> @@ -52,7 +53,6 @@ #include "mongo/db/repl/sync_source_selector.h" #include "mongo/dbtests/mock/mock_dbclient_connection.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/fail_point_service.h" @@ -82,17 +82,17 @@ class StorageInterface; struct InitialSyncerOptions { /** Function to return optime of last operation applied on this node */ - using GetMyLastOptimeFn = stdx::function<OpTime()>; + using GetMyLastOptimeFn = std::function<OpTime()>; /** Function to update optime of last operation applied on this node */ - using SetMyLastOptimeFn = stdx::function<void( + using SetMyLastOptimeFn = std::function<void( const OpTimeAndWallTime&, ReplicationCoordinator::DataConsistency consistency)>; /** Function to reset all optimes on this node (e.g. applied & durable). */ - using ResetOptimesFn = stdx::function<void()>; + using ResetOptimesFn = std::function<void()>; /** Function to sets this node into a specific follower mode. */ - using SetFollowerModeFn = stdx::function<bool(const MemberState&)>; + using SetFollowerModeFn = std::function<bool(const MemberState&)>; // Error and retry values Milliseconds syncSourceRetryWait{1000}; @@ -145,7 +145,7 @@ public: /** * Callback function to report last applied optime of initial sync. */ - typedef stdx::function<void(const StatusWith<OpTimeAndWallTime>& lastApplied)> OnCompletionFn; + typedef std::function<void(const StatusWith<OpTimeAndWallTime>& lastApplied)> OnCompletionFn; /** * Callback completion guard for initial syncer. diff --git a/src/mongo/db/repl/multiapplier.h b/src/mongo/db/repl/multiapplier.h index 87d34964c2f..119cd58bc89 100644 --- a/src/mongo/db/repl/multiapplier.h +++ b/src/mongo/db/repl/multiapplier.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <iosfwd> #include <memory> #include <string> @@ -43,7 +44,6 @@ #include "mongo/db/service_context.h" #include "mongo/executor/task_executor.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { @@ -69,7 +69,7 @@ public: using CallbackFn = unique_function<void(const Status&)>; using MultiApplyFn = - stdx::function<StatusWith<OpTime>(OperationContext*, MultiApplier::Operations)>; + std::function<StatusWith<OpTime>(OperationContext*, MultiApplier::Operations)>; /** * Creates MultiApplier in inactive state. diff --git a/src/mongo/db/repl/noop_writer.cpp b/src/mongo/db/repl/noop_writer.cpp index 8c0fbfaa6b9..f8495278ce1 100644 --- a/src/mongo/db/repl/noop_writer.cpp +++ b/src/mongo/db/repl/noop_writer.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <functional> + #include "mongo/db/commands.h" #include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/concurrency/d_concurrency.h" @@ -41,7 +43,6 @@ #include "mongo/db/repl/noop_writer.h" #include "mongo/db/repl/oplog.h" #include "mongo/db/repl/repl_server_parameters_gen.h" -#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/log.h" @@ -63,7 +64,7 @@ class NoopWriter::PeriodicNoopRunner { PeriodicNoopRunner(const PeriodicNoopRunner&) = delete; PeriodicNoopRunner& operator=(const PeriodicNoopRunner&) = delete; - using NoopWriteFn = stdx::function<void(OperationContext*)>; + using NoopWriteFn = std::function<void(OperationContext*)>; public: PeriodicNoopRunner(Seconds waitTime, NoopWriteFn noopWrite) diff --git a/src/mongo/db/repl/noop_writer.h b/src/mongo/db/repl/noop_writer.h index 07f664668d0..c9cc5712386 100644 --- a/src/mongo/db/repl/noop_writer.h +++ b/src/mongo/db/repl/noop_writer.h @@ -29,8 +29,9 @@ #pragma once +#include <functional> + #include "mongo/db/repl/optime.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/time_support.h" diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 11fa6719a1c..f56af4a7b57 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -808,14 +808,14 @@ NamespaceString parseUUIDorNs(OperationContext* opCtx, return ui.ok() ? parseUUID(opCtx, ui) : parseNs(ns, cmd); } -using OpApplyFn = stdx::function<Status(OperationContext* opCtx, - const char* ns, - const BSONElement& ui, - BSONObj& cmd, - const OpTime& opTime, - const OplogEntry& entry, - OplogApplication::Mode mode, - boost::optional<Timestamp> stableTimestampForRecovery)>; +using OpApplyFn = std::function<Status(OperationContext* opCtx, + const char* ns, + const BSONElement& ui, + BSONObj& cmd, + const OpTime& opTime, + const OplogEntry& entry, + OplogApplication::Mode mode, + boost::optional<Timestamp> stableTimestampForRecovery)>; struct ApplyOpMetadata { OpApplyFn applyFunc; diff --git a/src/mongo/db/repl/oplog.h b/src/mongo/db/repl/oplog.h index b8729038179..7ad2c4bb983 100644 --- a/src/mongo/db/repl/oplog.h +++ b/src/mongo/db/repl/oplog.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <string> #include <vector> @@ -40,7 +41,6 @@ #include "mongo/db/repl/oplog_entry.h" #include "mongo/db/repl/optime.h" #include "mongo/db/repl/replication_coordinator.h" -#include "mongo/stdx/functional.h" namespace mongo { class Collection; @@ -162,7 +162,7 @@ void acquireOplogCollectionForLogging(OperationContext* opCtx); */ void establishOplogCollectionForLogging(OperationContext* opCtx, Collection* oplog); -using IncrementOpsAppliedStatsFn = stdx::function<void()>; +using IncrementOpsAppliedStatsFn = std::function<void()>; /** * This class represents the different modes of oplog application that are used within the diff --git a/src/mongo/db/repl/oplog_applier.h b/src/mongo/db/repl/oplog_applier.h index 8208b35f4cf..71ea92b4f3f 100644 --- a/src/mongo/db/repl/oplog_applier.h +++ b/src/mongo/db/repl/oplog_applier.h @@ -104,7 +104,7 @@ public: using Operations = std::vector<OplogEntry>; // Used by SyncTail to access batching logic. - using GetNextApplierBatchFn = stdx::function<StatusWith<OplogApplier::Operations>( + using GetNextApplierBatchFn = std::function<StatusWith<OplogApplier::Operations>( OperationContext* opCtx, const BatchLimits& batchLimits)>; /** diff --git a/src/mongo/db/repl/oplog_buffer_collection_test.cpp b/src/mongo/db/repl/oplog_buffer_collection_test.cpp index 0d544104fc6..b27c713f471 100644 --- a/src/mongo/db/repl/oplog_buffer_collection_test.cpp +++ b/src/mongo/db/repl/oplog_buffer_collection_test.cpp @@ -919,13 +919,12 @@ TEST_F(OplogBufferCollectionTest, WaitForDataBlocksAndTimesOutWhenItDoesNotFindD ASSERT_EQUALS(count, 0UL); } -void _testPushSentinelsProperly( - OperationContext* opCtx, - const NamespaceString& nss, - StorageInterface* storageInterface, - stdx::function<void(OperationContext* opCtx, - OplogBufferCollection* oplogBuffer, - const std::vector<BSONObj>& oplog)> pushDocsFn) { +void _testPushSentinelsProperly(OperationContext* opCtx, + const NamespaceString& nss, + StorageInterface* storageInterface, + std::function<void(OperationContext* opCtx, + OplogBufferCollection* oplogBuffer, + const std::vector<BSONObj>& oplog)> pushDocsFn) { OplogBufferCollection oplogBuffer(storageInterface, nss); oplogBuffer.startup(opCtx); const std::vector<BSONObj> oplog = { diff --git a/src/mongo/db/repl/oplog_buffer_proxy_test.cpp b/src/mongo/db/repl/oplog_buffer_proxy_test.cpp index 33173a8b75a..269071bbc54 100644 --- a/src/mongo/db/repl/oplog_buffer_proxy_test.cpp +++ b/src/mongo/db/repl/oplog_buffer_proxy_test.cpp @@ -31,10 +31,10 @@ #include <boost/optional/optional_io.hpp> #include <deque> +#include <functional> #include "mongo/db/jsobj.h" #include "mongo/db/repl/oplog_buffer_proxy.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -231,7 +231,7 @@ void _testPushFunctionUpdatesCachedLastObjectPushed( OperationContext* opCtx, OplogBuffer* proxy, OplogBufferMock* mock, - stdx::function<std::size_t( + std::function<std::size_t( OperationContext* opCtx, OplogBuffer* proxy, const OplogBuffer::Value& value)> pushFn) { ASSERT_EQUALS(proxy->lastObjectPushed(opCtx), boost::none); ASSERT_FALSE(mock->lastObjectPushedCalled); diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h index 398ac362377..f547304ac39 100644 --- a/src/mongo/db/repl/oplog_fetcher.h +++ b/src/mongo/db/repl/oplog_fetcher.h @@ -30,6 +30,7 @@ #pragma once #include <cstddef> +#include <functional> #include "mongo/base/status_with.h" #include "mongo/bson/timestamp.h" @@ -38,7 +39,6 @@ #include "mongo/db/repl/abstract_oplog_fetcher.h" #include "mongo/db/repl/data_replicator_external_state.h" #include "mongo/db/repl/repl_set_config.h" -#include "mongo/stdx/functional.h" #include "mongo/util/fail_point_service.h" namespace mongo { @@ -104,9 +104,9 @@ public: * Additional information on the operations is provided in a DocumentsInfo * struct. */ - using EnqueueDocumentsFn = stdx::function<Status(Fetcher::Documents::const_iterator begin, - Fetcher::Documents::const_iterator end, - const DocumentsInfo& info)>; + using EnqueueDocumentsFn = std::function<Status(Fetcher::Documents::const_iterator begin, + Fetcher::Documents::const_iterator end, + const DocumentsInfo& info)>; /** * Validates documents in current batch of results returned from tailing the remote oplog. diff --git a/src/mongo/db/repl/oplog_fetcher_test.cpp b/src/mongo/db/repl/oplog_fetcher_test.cpp index 1550d0882ed..ed79d6a7a27 100644 --- a/src/mongo/db/repl/oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/oplog_fetcher_test.cpp @@ -176,7 +176,7 @@ std::unique_ptr<ShutdownState> OplogFetcherTest::processSingleBatch(RemoteComman requireFresherSyncSource, dataReplicatorExternalState.get(), enqueueDocumentsFn, - stdx::ref(*shutdownState), + std::ref(*shutdownState), defaultBatchSize); ASSERT_FALSE(oplogFetcher.isActive()); @@ -590,7 +590,7 @@ TEST_F(OplogFetcherTest, false /* requireFresherSyncSource */, dataReplicatorExternalState.get(), enqueueDocumentsFn, - stdx::ref(*shutdownState), + std::ref(*shutdownState), defaultBatchSize, OplogFetcher::StartingPoint::kEnqueueFirstDoc); @@ -666,7 +666,7 @@ TEST_F(OplogFetcherTest, false /* requireFresherSyncSource */, dataReplicatorExternalState.get(), enqueueDocumentsFn, - stdx::ref(*shutdownState), + std::ref(*shutdownState), defaultBatchSize, OplogFetcher::StartingPoint::kEnqueueFirstDoc); @@ -826,7 +826,7 @@ RemoteCommandRequest OplogFetcherTest::testTwoBatchHandling() { true, dataReplicatorExternalState.get(), enqueueDocumentsFn, - stdx::ref(shutdownState), + std::ref(shutdownState), defaultBatchSize); ASSERT_EQUALS(OplogFetcher::State::kPreStart, oplogFetcher.getState_forTest()); diff --git a/src/mongo/db/repl/oplog_interface_remote.h b/src/mongo/db/repl/oplog_interface_remote.h index 97ed5f7fff6..8200056f34f 100644 --- a/src/mongo/db/repl/oplog_interface_remote.h +++ b/src/mongo/db/repl/oplog_interface_remote.h @@ -29,8 +29,9 @@ #pragma once +#include <functional> + #include "mongo/db/repl/oplog_interface.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -47,7 +48,7 @@ public: /** * Type of function to return a connection to the sync source. */ - using GetConnectionFn = stdx::function<DBClientBase*()>; + using GetConnectionFn = std::function<DBClientBase*()>; OplogInterfaceRemote(HostAndPort hostAndPort, GetConnectionFn getConnection, diff --git a/src/mongo/db/repl/oplog_test.cpp b/src/mongo/db/repl/oplog_test.cpp index b95f8d2d4fc..c8506d55fbd 100644 --- a/src/mongo/db/repl/oplog_test.cpp +++ b/src/mongo/db/repl/oplog_test.cpp @@ -30,6 +30,7 @@ #include "mongo/platform/basic.h" #include <algorithm> +#include <functional> #include <map> #include <utility> #include <vector> @@ -44,7 +45,6 @@ #include "mongo/db/repl/repl_client_info.h" #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/unittest/barrier.h" #include "mongo/util/concurrency/thread_pool.h" diff --git a/src/mongo/db/repl/repl_set_config.cpp b/src/mongo/db/repl/repl_set_config.cpp index ced480e9d04..a3f27decf09 100644 --- a/src/mongo/db/repl/repl_set_config.cpp +++ b/src/mongo/db/repl/repl_set_config.cpp @@ -32,13 +32,13 @@ #include "mongo/db/repl/repl_set_config.h" #include <algorithm> +#include <functional> #include "mongo/bson/util/bson_check.h" #include "mongo/bson/util/bson_extract.h" #include "mongo/db/jsobj.h" #include "mongo/db/mongod_options.h" #include "mongo/db/server_options.h" -#include "mongo/stdx/functional.h" #include "mongo/util/str.h" namespace mongo { diff --git a/src/mongo/db/repl/repl_set_tag.cpp b/src/mongo/db/repl/repl_set_tag.cpp index 8068b46e783..573892a94b9 100644 --- a/src/mongo/db/repl/repl_set_tag.cpp +++ b/src/mongo/db/repl/repl_set_tag.cpp @@ -32,10 +32,10 @@ #include "mongo/db/repl/repl_set_tag.h" #include <algorithm> +#include <functional> #include "mongo/base/string_data.h" #include "mongo/db/jsobj.h" -#include "mongo/stdx/functional.h" #include "mongo/util/sequence_util.h" #include "mongo/util/str.h" diff --git a/src/mongo/db/repl/replication_coordinator_external_state.h b/src/mongo/db/repl/replication_coordinator_external_state.h index aa81dc2b6cf..89bba1762ee 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state.h +++ b/src/mongo/db/repl/replication_coordinator_external_state.h @@ -31,12 +31,12 @@ #include <boost/optional.hpp> #include <cstddef> +#include <functional> #include "mongo/bson/timestamp.h" #include "mongo/db/repl/member_state.h" #include "mongo/db/repl/optime.h" #include "mongo/executor/task_executor.h" -#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/time_support.h" diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp index fe934c8edaf..5736969f762 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp @@ -33,6 +33,7 @@ #include "mongo/db/repl/replication_coordinator_external_state_impl.h" +#include <functional> #include <string> #include "mongo/base/status_with.h" @@ -93,7 +94,6 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/cluster_identity_loader.h" #include "mongo/s/grid.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/transport/service_entry_point.h" diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 87eea64b6c1..31c3bd56fe0 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -36,6 +36,7 @@ #include "mongo/db/repl/replication_coordinator_impl.h" #include <algorithm> +#include <functional> #include <limits> #include "mongo/base/status.h" @@ -83,7 +84,6 @@ #include "mongo/executor/network_interface.h" #include "mongo/rpc/metadata/oplog_query_metadata.h" #include "mongo/rpc/metadata/repl_set_metadata.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/fail_point_service.h" @@ -149,7 +149,7 @@ private: const bool _initialState; }; -void lockAndCall(stdx::unique_lock<stdx::mutex>* lk, const stdx::function<void()>& fn) { +void lockAndCall(stdx::unique_lock<stdx::mutex>* lk, const std::function<void()>& fn) { if (!lk->owns_lock()) { lk->lock(); } @@ -249,8 +249,7 @@ void ReplicationCoordinatorImpl::WaiterList::add_inlock(WaiterType waiter) { _list.push_back(waiter); } -void ReplicationCoordinatorImpl::WaiterList::signalIf_inlock( - stdx::function<bool(WaiterType)> func) { +void ReplicationCoordinatorImpl::WaiterList::signalIf_inlock(std::function<bool(WaiterType)> func) { for (auto it = _list.begin(); it != _list.end();) { if (!func(*it)) { // This element doesn't match, so we advance the iterator to the next one. @@ -688,7 +687,7 @@ void ReplicationCoordinatorImpl::_stopDataReplication(OperationContext* opCtx) { } void ReplicationCoordinatorImpl::_startDataReplication(OperationContext* opCtx, - stdx::function<void()> startCompleted) { + std::function<void()> startCompleted) { // Check to see if we need to do an initial sync. const auto lastOpTime = getMyLastAppliedOpTime(); const auto needsInitialSync = @@ -2308,7 +2307,7 @@ int ReplicationCoordinatorImpl::_getMyId_inlock() const { Status ReplicationCoordinatorImpl::resyncData(OperationContext* opCtx, bool waitUntilCompleted) { _stopDataReplication(opCtx); auto finishedEvent = uassertStatusOK(_replExecutor->makeEvent()); - stdx::function<void()> f; + std::function<void()> f; if (waitUntilCompleted) f = [&finishedEvent, this]() { _replExecutor->signalEvent(finishedEvent); }; @@ -3928,7 +3927,7 @@ WriteConcernOptions ReplicationCoordinatorImpl::populateUnsetWriteConcernOptions return writeConcern; } -CallbackFn ReplicationCoordinatorImpl::_wrapAsCallbackFn(const stdx::function<void()>& work) { +CallbackFn ReplicationCoordinatorImpl::_wrapAsCallbackFn(const std::function<void()>& work) { return [work](const CallbackArgs& cbData) { if (cbData.status == ErrorCodes::CallbackCanceled) { return; diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index b7a3e429b83..ffec3ea11ad 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -430,7 +430,7 @@ private: using EventHandle = executor::TaskExecutor::EventHandle; - using ScheduleFn = stdx::function<StatusWith<executor::TaskExecutor::CallbackHandle>( + using ScheduleFn = std::function<StatusWith<executor::TaskExecutor::CallbackHandle>( const executor::TaskExecutor::CallbackFn& work)>; class LoseElectionGuardV1; @@ -611,7 +611,7 @@ private: // // This is used when we want to run a callback when the opTime is reached. struct CallbackWaiter : public Waiter { - using FinishFunc = stdx::function<void()>; + using FinishFunc = std::function<void()>; CallbackWaiter(OpTime _opTime, FinishFunc _finishCallback); void notify_inlock() override; @@ -634,7 +634,7 @@ private: // Returns whether waiter is found and removed. bool remove_inlock(WaiterType waiter); // Signals all waiters that satisfy the condition. - void signalIf_inlock(stdx::function<bool(WaiterType)> fun); + void signalIf_inlock(std::function<bool(WaiterType)> fun); // Signals all waiters from the list. void signalAll_inlock(); @@ -937,7 +937,7 @@ private: * Start replicating data, and does an initial sync if needed first. */ void _startDataReplication(OperationContext* opCtx, - stdx::function<void()> startCompleted = nullptr); + std::function<void()> startCompleted = nullptr); /** * Stops replicating data by stopping the applier, fetcher and such. @@ -1282,7 +1282,7 @@ private: * Wrap a function into executor callback. * If the callback is cancelled, the given function won't run. */ - executor::TaskExecutor::CallbackFn _wrapAsCallbackFn(const stdx::function<void()>& work); + executor::TaskExecutor::CallbackFn _wrapAsCallbackFn(const std::function<void()>& work); /** * Finish catch-up mode and start drain mode. diff --git a/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp index 3c088e5d2cb..ad48c0393e2 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp @@ -2144,7 +2144,7 @@ TEST_F(ReplCoordTest, NodeCancelsElectionUponReceivingANewConfigDuringVotePhase) class PrimaryCatchUpTest : public ReplCoordTest { protected: using NetworkOpIter = NetworkInterfaceMock::NetworkOperationIterator; - using NetworkRequestFn = stdx::function<void(const NetworkOpIter)>; + using NetworkRequestFn = std::function<void(const NetworkOpIter)>; const Timestamp smallTimestamp{1, 1}; diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp index 95af8076f33..4210f02d428 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp @@ -36,6 +36,7 @@ #include "mongo/platform/basic.h" #include <algorithm> +#include <functional> #include "mongo/base/status.h" #include "mongo/db/index_builds_coordinator.h" @@ -54,7 +55,6 @@ #include "mongo/db/service_context.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/metadata/repl_set_metadata.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/fail_point_service.h" diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp index 821c2d71202..790a6c81704 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include <boost/optional/optional_io.hpp> +#include <functional> #include <iostream> #include <memory> #include <set> @@ -63,7 +64,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/rpc/metadata/oplog_query_metadata.h" #include "mongo/rpc/metadata/repl_set_metadata.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/future.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/barrier.h" diff --git a/src/mongo/db/repl/replication_coordinator_mock.h b/src/mongo/db/repl/replication_coordinator_mock.h index 38ec9d5a3b6..0a9e49f3e5e 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.h +++ b/src/mongo/db/repl/replication_coordinator_mock.h @@ -29,13 +29,14 @@ #pragma once +#include <functional> + #include "mongo/base/status.h" #include "mongo/db/repl/optime.h" #include "mongo/db/repl/repl_set_config.h" #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/repl/storage_interface.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -288,7 +289,7 @@ public: * Sets the function to generate the return value for calls to awaitReplication(). * 'opTime' is the optime passed to awaitReplication(). */ - using AwaitReplicationReturnValueFunction = stdx::function<StatusAndDuration(const OpTime&)>; + using AwaitReplicationReturnValueFunction = std::function<StatusAndDuration(const OpTime&)>; void setAwaitReplicationReturnValueFunction( AwaitReplicationReturnValueFunction returnValueFunction); diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp index 8324d84232f..197be4e4d0b 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp @@ -33,6 +33,8 @@ #include "mongo/db/repl/replication_coordinator_test_fixture.h" +#include <functional> + #include "mongo/db/logical_clock.h" #include "mongo/db/operation_context_noop.h" #include "mongo/db/repl/is_master_response.h" @@ -49,7 +51,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_mock.h" #include "mongo/executor/thread_pool_task_executor.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point_service.h" @@ -252,7 +253,7 @@ void ReplCoordTest::simulateEnoughHeartbeatsForAllNodesUp() { } void ReplCoordTest::simulateSuccessfulDryRun( - stdx::function<void(const RemoteCommandRequest& request)> onDryRunRequest) { + std::function<void(const RemoteCommandRequest& request)> onDryRunRequest) { ReplicationCoordinatorImpl* replCoord = getReplCoord(); ReplSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest(); NetworkInterfaceMock* net = getNet(); diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.h b/src/mongo/db/repl/replication_coordinator_test_fixture.h index c3d7cd14d28..de593d2b804 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.h +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.h @@ -246,7 +246,7 @@ protected: * Applicable to protocol version 1 only. */ void simulateSuccessfulDryRun( - stdx::function<void(const executor::RemoteCommandRequest& request)> onDryRunRequest); + std::function<void(const executor::RemoteCommandRequest& request)> onDryRunRequest); void simulateSuccessfulDryRun(); /** diff --git a/src/mongo/db/repl/reporter.h b/src/mongo/db/repl/reporter.h index f332401ea2e..f6cc0ea8cea 100644 --- a/src/mongo/db/repl/reporter.h +++ b/src/mongo/db/repl/reporter.h @@ -29,13 +29,14 @@ #pragma once +#include <functional> + #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/db/jsobj.h" #include "mongo/db/repl/replication_coordinator.h" #include "mongo/executor/task_executor.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/time_support.h" @@ -73,7 +74,7 @@ public: * * The returned status indicates whether or not the command was created. */ - using PrepareReplSetUpdatePositionCommandFn = stdx::function<StatusWith<BSONObj>()>; + using PrepareReplSetUpdatePositionCommandFn = std::function<StatusWith<BSONObj>()>; Reporter(executor::TaskExecutor* executor, PrepareReplSetUpdatePositionCommandFn prepareReplSetUpdatePositionCommandFn, diff --git a/src/mongo/db/repl/roll_back_local_operations.h b/src/mongo/db/repl/roll_back_local_operations.h index 57780fb755a..baff79544a6 100644 --- a/src/mongo/db/repl/roll_back_local_operations.h +++ b/src/mongo/db/repl/roll_back_local_operations.h @@ -29,6 +29,8 @@ #pragma once +#include <functional> + #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/bson/bsonobj.h" @@ -36,7 +38,6 @@ #include "mongo/db/repl/oplog_entry.h" #include "mongo/db/repl/oplog_interface.h" #include "mongo/db/repl/optime.h" -#include "mongo/stdx/functional.h" #include "mongo/util/fail_point_service.h" namespace mongo { @@ -85,7 +86,7 @@ public: * Type of function to roll back an operation or process it for future use. * It can return any status except ErrorCodes::NoSuchKey. See onRemoteOperation(). */ - using RollbackOperationFn = stdx::function<Status(const BSONObj&)>; + using RollbackOperationFn = std::function<Status(const BSONObj&)>; /** * Initializes rollback processor with a valid local oplog. diff --git a/src/mongo/db/repl/rollback.h b/src/mongo/db/repl/rollback.h index 26af57b79e9..8f49ea8a04b 100644 --- a/src/mongo/db/repl/rollback.h +++ b/src/mongo/db/repl/rollback.h @@ -29,9 +29,10 @@ #pragma once +#include <functional> + #include "mongo/base/status_with.h" #include "mongo/db/repl/optime.h" -#include "mongo/stdx/functional.h" namespace mongo { namespace repl { @@ -50,7 +51,7 @@ public: * passed in. */ using OnCompletionFn = - stdx::function<void(const StatusWith<OpTime>& lastOpTimeApplied) noexcept>; + std::function<void(const StatusWith<OpTime>& lastOpTimeApplied) noexcept>; Rollback() = default; diff --git a/src/mongo/db/repl/rollback_checker.h b/src/mongo/db/repl/rollback_checker.h index ed589e57c7c..768dd47bf63 100644 --- a/src/mongo/db/repl/rollback_checker.h +++ b/src/mongo/db/repl/rollback_checker.h @@ -67,7 +67,7 @@ public: // Rollback checker result - true if rollback occurred; false if rollback IDs // were the same; Otherwise, error status indicating why rollback check failed. using Result = StatusWith<bool>; - using CallbackFn = stdx::function<void(const Result& result)>; + using CallbackFn = std::function<void(const Result& result)>; using RemoteCommandCallbackFn = executor::TaskExecutor::RemoteCommandCallbackFn; using CallbackHandle = executor::TaskExecutor::CallbackHandle; diff --git a/src/mongo/db/repl/rollback_impl.h b/src/mongo/db/repl/rollback_impl.h index 428305ff005..29a33dfd548 100644 --- a/src/mongo/db/repl/rollback_impl.h +++ b/src/mongo/db/repl/rollback_impl.h @@ -29,13 +29,14 @@ #pragma once +#include <functional> + #include "mongo/base/status_with.h" #include "mongo/db/op_observer.h" #include "mongo/db/repl/oplog_entry.h" #include "mongo/db/repl/roll_back_local_operations.h" #include "mongo/db/repl/rollback.h" #include "mongo/db/repl/storage_interface.h" -#include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/repl/rollback_impl_test.cpp b/src/mongo/db/repl/rollback_impl_test.cpp index c32031f1f95..78327f0d2a3 100644 --- a/src/mongo/db/repl/rollback_impl_test.cpp +++ b/src/mongo/db/repl/rollback_impl_test.cpp @@ -258,40 +258,40 @@ protected: std::unique_ptr<RollbackImplForTest> _rollback; bool _transitionedToRollback = false; - stdx::function<void()> _onTransitionToRollbackFn = [this]() { _transitionedToRollback = true; }; + std::function<void()> _onTransitionToRollbackFn = [this]() { _transitionedToRollback = true; }; bool _recoveredToStableTimestamp = false; Timestamp _stableTimestamp; - stdx::function<void(Timestamp)> _onRecoverToStableTimestampFn = + std::function<void(Timestamp)> _onRecoverToStableTimestampFn = [this](Timestamp stableTimestamp) { _recoveredToStableTimestamp = true; _stableTimestamp = stableTimestamp; }; bool _recoveredFromOplog = false; - stdx::function<void()> _onRecoverFromOplogFn = [this]() { _recoveredFromOplog = true; }; + std::function<void()> _onRecoverFromOplogFn = [this]() { _recoveredFromOplog = true; }; bool _incrementedRollbackID = false; - stdx::function<void()> _onRollbackIDIncrementedFn = [this]() { _incrementedRollbackID = true; }; + std::function<void()> _onRollbackIDIncrementedFn = [this]() { _incrementedRollbackID = true; }; bool _reconstructedPreparedTransactions = false; - stdx::function<void()> _onPreparedTransactionsReconstructedFn = [this]() { + std::function<void()> _onPreparedTransactionsReconstructedFn = [this]() { _reconstructedPreparedTransactions = true; }; Timestamp _commonPointFound; - stdx::function<void(Timestamp commonPoint)> _onCommonPointFoundFn = + std::function<void(Timestamp commonPoint)> _onCommonPointFoundFn = [this](Timestamp commonPoint) { _commonPointFound = commonPoint; }; Timestamp _truncatePoint; - stdx::function<void(Timestamp truncatePoint)> _onSetOplogTruncateAfterPointFn = + std::function<void(Timestamp truncatePoint)> _onSetOplogTruncateAfterPointFn = [this](Timestamp truncatePoint) { _truncatePoint = truncatePoint; }; bool _triggeredOpObserver = false; - stdx::function<void(const OpObserver::RollbackObserverInfo& rbInfo)> _onRollbackOpObserverFn = + std::function<void(const OpObserver::RollbackObserverInfo& rbInfo)> _onRollbackOpObserverFn = [this](const OpObserver::RollbackObserverInfo& rbInfo) { _triggeredOpObserver = true; }; - stdx::function<void(UUID, NamespaceString)> _onRollbackFileWrittenForNamespaceFn = + std::function<void(UUID, NamespaceString)> _onRollbackFileWrittenForNamespaceFn = [this](UUID, NamespaceString) {}; std::unique_ptr<Listener> _listener; diff --git a/src/mongo/db/repl/rollback_source_impl.h b/src/mongo/db/repl/rollback_source_impl.h index 1c283eb5ed8..66635dde23d 100644 --- a/src/mongo/db/repl/rollback_source_impl.h +++ b/src/mongo/db/repl/rollback_source_impl.h @@ -29,11 +29,11 @@ #pragma once +#include <functional> #include <string> #include "mongo/db/repl/oplog_interface_remote.h" #include "mongo/db/repl/rollback_source.h" -#include "mongo/stdx/functional.h" #include "mongo/util/net/hostandport.h" namespace mongo { @@ -51,7 +51,7 @@ public: /** * Type of function to return a connection to the sync source. */ - using GetConnectionFn = stdx::function<DBClientBase*()>; + using GetConnectionFn = std::function<DBClientBase*()>; RollbackSourceImpl(GetConnectionFn getConnection, const HostAndPort& source, diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index e27d463b0f7..e2fc2bcdb23 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -1620,7 +1620,7 @@ void rollback(OperationContext* opCtx, int requiredRBID, ReplicationCoordinator* replCoord, ReplicationProcess* replicationProcess, - stdx::function<void(int)> sleepSecsFn) { + std::function<void(int)> sleepSecsFn) { // Set state to ROLLBACK while we are in this function. This prevents serving reads, even from // the oplog. This can fail if we are elected PRIMARY, in which case we better not do any // rolling back. If we successfully enter ROLLBACK we will only exit this function fatally or diff --git a/src/mongo/db/repl/rs_rollback.h b/src/mongo/db/repl/rs_rollback.h index 619327ff3eb..922e8c667ae 100644 --- a/src/mongo/db/repl/rs_rollback.h +++ b/src/mongo/db/repl/rs_rollback.h @@ -29,12 +29,13 @@ #pragma once +#include <functional> + #include "mongo/base/status.h" #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" #include "mongo/db/record_id.h" #include "mongo/db/repl/optime.h" -#include "mongo/stdx/functional.h" #include "mongo/util/time_support.h" #include "mongo/util/uuid.h" @@ -148,7 +149,7 @@ void rollback(OperationContext* opCtx, int requiredRBID, ReplicationCoordinator* replCoord, ReplicationProcess* replicationProcess, - stdx::function<void(int)> sleepSecsFn = [](int secs) { sleepsecs(secs); }); + std::function<void(int)> sleepSecsFn = [](int secs) { sleepsecs(secs); }); /** * Initiates the rollback process after transition to ROLLBACK. diff --git a/src/mongo/db/repl/scatter_gather_runner.cpp b/src/mongo/db/repl/scatter_gather_runner.cpp index 77c87778308..20d392acf44 100644 --- a/src/mongo/db/repl/scatter_gather_runner.cpp +++ b/src/mongo/db/repl/scatter_gather_runner.cpp @@ -34,10 +34,10 @@ #include "mongo/db/repl/scatter_gather_runner.h" #include <algorithm> +#include <functional> #include "mongo/base/status_with.h" #include "mongo/db/repl/scatter_gather_algorithm.h" -#include "mongo/stdx/functional.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/db/repl/scatter_gather_runner.h b/src/mongo/db/repl/scatter_gather_runner.h index 4d65e417efb..d38bdc4862b 100644 --- a/src/mongo/db/repl/scatter_gather_runner.h +++ b/src/mongo/db/repl/scatter_gather_runner.h @@ -29,10 +29,10 @@ #pragma once +#include <functional> #include <vector> #include "mongo/executor/task_executor.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { diff --git a/src/mongo/db/repl/scatter_gather_test.cpp b/src/mongo/db/repl/scatter_gather_test.cpp index 164b5724b17..94c5e13d55e 100644 --- a/src/mongo/db/repl/scatter_gather_test.cpp +++ b/src/mongo/db/repl/scatter_gather_test.cpp @@ -29,10 +29,11 @@ #include "mongo/platform/basic.h" +#include <functional> + #include "mongo/db/repl/scatter_gather_algorithm.h" #include "mongo/db/repl/scatter_gather_runner.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/repl/storage_interface_impl_test.cpp b/src/mongo/db/repl/storage_interface_impl_test.cpp index ecfed99d14d..6a2c23ad6fb 100644 --- a/src/mongo/db/repl/storage_interface_impl_test.cpp +++ b/src/mongo/db/repl/storage_interface_impl_test.cpp @@ -592,7 +592,7 @@ void _testDestroyUncommitedCollectionBulkLoader( OperationContext* opCtx, const NamespaceString& nss, std::vector<BSONObj> secondaryIndexes, - stdx::function<void(std::unique_ptr<CollectionBulkLoader> loader)> destroyLoaderFn) { + std::function<void(std::unique_ptr<CollectionBulkLoader> loader)> destroyLoaderFn) { StorageInterfaceImpl storage; CollectionOptions opts = generateOptionsWithUuid(); auto loaderStatus = diff --git a/src/mongo/db/repl/sync_source_resolver.h b/src/mongo/db/repl/sync_source_resolver.h index bf38628ac32..abe6396e650 100644 --- a/src/mongo/db/repl/sync_source_resolver.h +++ b/src/mongo/db/repl/sync_source_resolver.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <memory> #include "mongo/base/status.h" @@ -38,7 +39,6 @@ #include "mongo/db/repl/optime.h" #include "mongo/executor/task_executor.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -107,7 +107,7 @@ public: /** * Callback function to report final status of resolving sync source. */ - typedef stdx::function<void(const SyncSourceResolverResponse&)> OnCompletionFn; + typedef std::function<void(const SyncSourceResolverResponse&)> OnCompletionFn; SyncSourceResolver(executor::TaskExecutor* taskExecutor, SyncSourceSelector* syncSourceSelector, diff --git a/src/mongo/db/repl/sync_source_resolver_test.cpp b/src/mongo/db/repl/sync_source_resolver_test.cpp index 9e4761051bf..91e60979070 100644 --- a/src/mongo/db/repl/sync_source_resolver_test.cpp +++ b/src/mongo/db/repl/sync_source_resolver_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <functional> #include <memory> #include "mongo/db/cursor_id.h" @@ -39,7 +40,6 @@ #include "mongo/db/repl/sync_source_selector_mock.h" #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/unittest/task_executor_proxy.h" #include "mongo/unittest/unittest.h" @@ -52,7 +52,7 @@ using namespace mongo::repl; class TaskExecutorWithFailureInScheduleRemoteCommand : public unittest::TaskExecutorProxy { public: - using ShouldFailRequestFn = stdx::function<bool(const executor::RemoteCommandRequest&)>; + using ShouldFailRequestFn = std::function<bool(const executor::RemoteCommandRequest&)>; TaskExecutorWithFailureInScheduleRemoteCommand(executor::TaskExecutor* executor, ShouldFailRequestFn shouldFailRequest) diff --git a/src/mongo/db/repl/sync_source_selector_mock.h b/src/mongo/db/repl/sync_source_selector_mock.h index cbf8df0fe9f..9bf7bf4daba 100644 --- a/src/mongo/db/repl/sync_source_selector_mock.h +++ b/src/mongo/db/repl/sync_source_selector_mock.h @@ -29,9 +29,10 @@ #pragma once +#include <functional> + #include "mongo/db/repl/optime.h" #include "mongo/db/repl/sync_source_selector.h" -#include "mongo/stdx/functional.h" namespace mongo { namespace repl { @@ -44,7 +45,7 @@ class SyncSourceSelectorMock : public SyncSourceSelector { SyncSourceSelectorMock& operator=(const SyncSourceSelectorMock&) = delete; public: - using ChooseNewSyncSourceHook = stdx::function<void()>; + using ChooseNewSyncSourceHook = std::function<void()>; SyncSourceSelectorMock(); virtual ~SyncSourceSelectorMock(); diff --git a/src/mongo/db/repl/sync_tail.h b/src/mongo/db/repl/sync_tail.h index 8b8d4a4a5e0..fd314fd3564 100644 --- a/src/mongo/db/repl/sync_tail.h +++ b/src/mongo/db/repl/sync_tail.h @@ -30,6 +30,7 @@ #pragma once #include <deque> +#include <functional> #include <memory> #include "mongo/base/status.h" @@ -42,7 +43,6 @@ #include "mongo/db/repl/replication_consistency_markers.h" #include "mongo/db/repl/session_update_tracker.h" #include "mongo/db/repl/storage_interface.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/thread_pool.h" @@ -67,10 +67,10 @@ class OpTime; class SyncTail { public: using MultiSyncApplyFunc = - stdx::function<Status(OperationContext* opCtx, - MultiApplier::OperationPtrs* ops, - SyncTail* st, - WorkerMultikeyPathInfo* workerMultikeyPathInfo)>; + std::function<Status(OperationContext* opCtx, + MultiApplier::OperationPtrs* ops, + SyncTail* st, + WorkerMultikeyPathInfo* workerMultikeyPathInfo)>; /** * Applies the operation that is in param o. diff --git a/src/mongo/db/repl/task_executor_mock.h b/src/mongo/db/repl/task_executor_mock.h index 3e6ec13d960..daae7c198b1 100644 --- a/src/mongo/db/repl/task_executor_mock.h +++ b/src/mongo/db/repl/task_executor_mock.h @@ -40,9 +40,9 @@ namespace repl { */ class TaskExecutorMock : public unittest::TaskExecutorProxy { public: - using ShouldFailScheduleWorkRequestFn = stdx::function<bool()>; + using ShouldFailScheduleWorkRequestFn = std::function<bool()>; using ShouldFailScheduleRemoteCommandRequestFn = - stdx::function<bool(const executor::RemoteCommandRequestOnAny&)>; + std::function<bool(const executor::RemoteCommandRequestOnAny&)>; explicit TaskExecutorMock(executor::TaskExecutor* executor); diff --git a/src/mongo/db/repl/task_runner.h b/src/mongo/db/repl/task_runner.h index a63a428177f..9b15ed3d629 100644 --- a/src/mongo/db/repl/task_runner.h +++ b/src/mongo/db/repl/task_runner.h @@ -29,11 +29,11 @@ #pragma once +#include <functional> #include <list> #include "mongo/db/service_context.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/functional.h" diff --git a/src/mongo/db/repl/task_runner_test_fixture.cpp b/src/mongo/db/repl/task_runner_test_fixture.cpp index 077c0d833ce..ade615489b1 100644 --- a/src/mongo/db/repl/task_runner_test_fixture.cpp +++ b/src/mongo/db/repl/task_runner_test_fixture.cpp @@ -31,8 +31,9 @@ #include "mongo/db/repl/task_runner_test_fixture.h" +#include <functional> + #include "mongo/db/repl/task_runner.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/repl/topology_coordinator.h b/src/mongo/db/repl/topology_coordinator.h index 14180c4c06b..5c025f83775 100644 --- a/src/mongo/db/repl/topology_coordinator.h +++ b/src/mongo/db/repl/topology_coordinator.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <iosfwd> #include <string> @@ -38,7 +39,6 @@ #include "mongo/db/repl/split_horizon.h" #include "mongo/db/repl/update_position_args.h" #include "mongo/db/server_options.h" -#include "mongo/stdx/functional.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -531,7 +531,7 @@ public: void processLoseElection(); - using StepDownAttemptAbortFn = stdx::function<void()>; + using StepDownAttemptAbortFn = std::function<void()>; /** * Readies the TopologyCoordinator for an attempt to stepdown that may fail. This is used * when we receive a stepdown command (which can fail if not enough secondaries are caught up) diff --git a/src/mongo/db/repl/vote_requester.h b/src/mongo/db/repl/vote_requester.h index c411065a988..158e442124e 100644 --- a/src/mongo/db/repl/vote_requester.h +++ b/src/mongo/db/repl/vote_requester.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <memory> #include <vector> @@ -37,7 +38,6 @@ #include "mongo/db/repl/repl_set_config.h" #include "mongo/db/repl/scatter_gather_algorithm.h" #include "mongo/db/repl/scatter_gather_runner.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_set.h" diff --git a/src/mongo/db/repl/vote_requester_test.cpp b/src/mongo/db/repl/vote_requester_test.cpp index ca0bc29844e..97e5736cd76 100644 --- a/src/mongo/db/repl/vote_requester_test.cpp +++ b/src/mongo/db/repl/vote_requester_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <functional> #include <memory> #include "mongo/base/status.h" @@ -38,7 +39,6 @@ #include "mongo/db/repl/vote_requester.h" #include "mongo/executor/remote_command_request.h" #include "mongo/executor/remote_command_response.h" -#include "mongo/stdx/functional.h" #include "mongo/unittest/unittest.h" #include "mongo/util/str.h" diff --git a/src/mongo/db/s/catalog_cache_loader_mock.cpp b/src/mongo/db/s/catalog_cache_loader_mock.cpp index 89ea61c3697..a0112029736 100644 --- a/src/mongo/db/s/catalog_cache_loader_mock.cpp +++ b/src/mongo/db/s/catalog_cache_loader_mock.cpp @@ -130,7 +130,7 @@ std::shared_ptr<Notification<void>> CatalogCacheLoaderMock::getChunksSince( void CatalogCacheLoaderMock::getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { // Not implemented } diff --git a/src/mongo/db/s/catalog_cache_loader_mock.h b/src/mongo/db/s/catalog_cache_loader_mock.h index a325a9574b9..692df021d22 100644 --- a/src/mongo/db/s/catalog_cache_loader_mock.h +++ b/src/mongo/db/s/catalog_cache_loader_mock.h @@ -63,7 +63,7 @@ public: void getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) override; + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) override; /** * Sets the mocked collection entry result that getChunksSince will use to construct its return diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp index 9c2a40795f5..03fdc521c80 100644 --- a/src/mongo/db/s/migration_destination_manager.cpp +++ b/src/mongo/db/s/migration_destination_manager.cpp @@ -378,8 +378,8 @@ Status MigrationDestinationManager::start(OperationContext* opCtx, void MigrationDestinationManager::cloneDocumentsFromDonor( OperationContext* opCtx, - stdx::function<void(OperationContext*, BSONObj)> insertBatchFn, - stdx::function<BSONObj(OperationContext*)> fetchBatchFn) { + std::function<void(OperationContext*, BSONObj)> insertBatchFn, + std::function<BSONObj(OperationContext*)> fetchBatchFn) { SingleProducerSingleConsumerQueue<BSONObj>::Options options; options.maxQueueDepth = 1; diff --git a/src/mongo/db/s/migration_destination_manager.h b/src/mongo/db/s/migration_destination_manager.h index dcda2e37bee..6978f8b0a2b 100644 --- a/src/mongo/db/s/migration_destination_manager.h +++ b/src/mongo/db/s/migration_destination_manager.h @@ -113,8 +113,8 @@ public: */ static void cloneDocumentsFromDonor( OperationContext* opCtx, - stdx::function<void(OperationContext*, BSONObj)> insertBatchFn, - stdx::function<BSONObj(OperationContext*)> fetchBatchFn); + std::function<void(OperationContext*, BSONObj)> insertBatchFn, + std::function<BSONObj(OperationContext*)> fetchBatchFn); /** * Idempotent method, which causes the current ongoing migration to abort only if it has the diff --git a/src/mongo/db/s/read_only_catalog_cache_loader.cpp b/src/mongo/db/s/read_only_catalog_cache_loader.cpp index 912db215e5e..0f173047844 100644 --- a/src/mongo/db/s/read_only_catalog_cache_loader.cpp +++ b/src/mongo/db/s/read_only_catalog_cache_loader.cpp @@ -51,7 +51,7 @@ std::shared_ptr<Notification<void>> ReadOnlyCatalogCacheLoader::getChunksSince( void ReadOnlyCatalogCacheLoader::getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { return _configServerLoader.getDatabase(dbName, callbackFn); } diff --git a/src/mongo/db/s/read_only_catalog_cache_loader.h b/src/mongo/db/s/read_only_catalog_cache_loader.h index e04d245ee39..03f05d1d7a5 100644 --- a/src/mongo/db/s/read_only_catalog_cache_loader.h +++ b/src/mongo/db/s/read_only_catalog_cache_loader.h @@ -54,7 +54,7 @@ public: void getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) override; + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) override; private: ConfigServerCatalogCacheLoader _configServerLoader; diff --git a/src/mongo/db/s/session_catalog_migration_destination.cpp b/src/mongo/db/s/session_catalog_migration_destination.cpp index 1a900129e2f..baf4a29e4e5 100644 --- a/src/mongo/db/s/session_catalog_migration_destination.cpp +++ b/src/mongo/db/s/session_catalog_migration_destination.cpp @@ -33,6 +33,8 @@ #include "mongo/db/s/session_catalog_migration_destination.h" +#include <functional> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/client/connection_string.h" #include "mongo/db/concurrency/d_concurrency.h" @@ -47,7 +49,6 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" #include "mongo/s/shard_id.h" -#include "mongo/stdx/functional.h" #include "mongo/util/log.h" namespace mongo { diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp index 9c4a2b9ab8c..e6d312f6db4 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp +++ b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp @@ -429,7 +429,7 @@ std::shared_ptr<Notification<void>> ShardServerCatalogCacheLoader::getChunksSinc void ShardServerCatalogCacheLoader::getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { long long currentTerm; bool isPrimary; @@ -584,7 +584,7 @@ void ShardServerCatalogCacheLoader::_runSecondaryGetChunksSince( OperationContext* opCtx, const NamespaceString& nss, const ChunkVersion& catalogCacheSinceVersion, - stdx::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> callbackFn, + std::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> callbackFn, std::shared_ptr<Notification<void>> notify) { forcePrimaryCollectionRefreshAndWaitForReplication(opCtx, nss); @@ -600,7 +600,7 @@ void ShardServerCatalogCacheLoader::_schedulePrimaryGetChunksSince( const NamespaceString& nss, const ChunkVersion& catalogCacheSinceVersion, long long termScheduled, - stdx::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> callbackFn, + std::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> callbackFn, std::shared_ptr<Notification<void>> notify) { // Get the max version the loader has. @@ -712,7 +712,7 @@ void ShardServerCatalogCacheLoader::_schedulePrimaryGetChunksSince( void ShardServerCatalogCacheLoader::_runSecondaryGetDatabase( OperationContext* opCtx, StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { forcePrimaryDatabaseRefreshAndWaitForReplication(opCtx, dbName); @@ -725,7 +725,7 @@ void ShardServerCatalogCacheLoader::_schedulePrimaryGetDatabase( OperationContext* opCtx, StringData dbName, long long termScheduled, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { auto remoteRefreshFn = [ this, name = dbName.toString(), termScheduled ]( OperationContext * opCtx, StatusWith<DatabaseType> swDatabaseType) { if (swDatabaseType == ErrorCodes::NamespaceNotFound) { diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader.h b/src/mongo/db/s/shard_server_catalog_cache_loader.h index 9e998415793..b6472941e99 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader.h +++ b/src/mongo/db/s/shard_server_catalog_cache_loader.h @@ -82,7 +82,7 @@ public: void getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) override; + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) override; void waitForCollectionFlush(OperationContext* opCtx, const NamespaceString& nss) override; @@ -342,7 +342,7 @@ private: OperationContext* opCtx, const NamespaceString& nss, const ChunkVersion& catalogCacheSinceVersion, - stdx::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> callbackFn, + std::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> callbackFn, std::shared_ptr<Notification<void>> notify); /** @@ -361,7 +361,7 @@ private: const NamespaceString& nss, const ChunkVersion& catalogCacheSinceVersion, long long currentTerm, - stdx::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> callbackFn, + std::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> callbackFn, std::shared_ptr<Notification<void>> notify); /** @@ -373,7 +373,7 @@ private: void _runSecondaryGetDatabase( OperationContext* opCtx, StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn); + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn); /** * Refreshes db version from the config server's metadata store, and schedules maintenance @@ -389,7 +389,7 @@ private: OperationContext* opCtx, StringData dbName, long long termScheduled, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn); + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn); /** * Loads chunk metadata from the shard persisted metadata store and any in-memory tasks with diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp b/src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp index 2e862fed8cb..20241ce52fc 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp +++ b/src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp @@ -80,7 +80,7 @@ public: vector<ChunkType> setUpChunkLoaderWithFiveChunks(); const KeyPattern kKeyPattern = KeyPattern(BSON(kPattern << 1)); - const stdx::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> + const std::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)> kDoNothingCallbackFn = []( OperationContext * opCtx, StatusWith<CatalogCacheLoader::CollectionAndChangedChunks> swCollAndChunks) noexcept {}; diff --git a/src/mongo/db/s/sharding_initialization_mongod.h b/src/mongo/db/s/sharding_initialization_mongod.h index a205d68d1b2..241488ae3fe 100644 --- a/src/mongo/db/s/sharding_initialization_mongod.h +++ b/src/mongo/db/s/sharding_initialization_mongod.h @@ -29,11 +29,12 @@ #pragma once +#include <functional> + #include "mongo/base/string_data.h" #include "mongo/client/replica_set_change_notifier.h" #include "mongo/db/s/sharding_state.h" #include "mongo/db/s/type_shard_identity.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -52,7 +53,7 @@ class ShardingInitializationMongoD { ShardingInitializationMongoD& operator=(const ShardingInitializationMongoD&) = delete; public: - using ShardingEnvironmentInitFunc = stdx::function<void( + using ShardingEnvironmentInitFunc = std::function<void( OperationContext* opCtx, const ShardIdentity& shardIdentity, StringData distLockProcessId)>; ShardingInitializationMongoD(); diff --git a/src/mongo/db/service_liaison.h b/src/mongo/db/service_liaison.h index f508cbb9831..fced0082bee 100644 --- a/src/mongo/db/service_liaison.h +++ b/src/mongo/db/service_liaison.h @@ -29,9 +29,10 @@ #pragma once +#include <functional> + #include "mongo/db/logical_session_id.h" #include "mongo/db/session_killer.h" -#include "mongo/stdx/functional.h" #include "mongo/util/periodic_runner.h" #include "mongo/util/time_support.h" diff --git a/src/mongo/db/session_catalog.h b/src/mongo/db/session_catalog.h index d0f97902461..11474425766 100644 --- a/src/mongo/db/session_catalog.h +++ b/src/mongo/db/session_catalog.h @@ -98,7 +98,7 @@ public: * Iterates through the SessionCatalog and applies 'workerFn' to each Session. This locks the * SessionCatalog. */ - using ScanSessionsCallbackFn = stdx::function<void(ObservableSession&)>; + using ScanSessionsCallbackFn = std::function<void(ObservableSession&)>; void scanSession(const LogicalSessionId& lsid, const ScanSessionsCallbackFn& workerFn); void scanSessions(const SessionKiller::Matcher& matcher, const ScanSessionsCallbackFn& workerFn); diff --git a/src/mongo/db/session_killer.h b/src/mongo/db/session_killer.h index 5df03edcaee..44f58509d70 100644 --- a/src/mongo/db/session_killer.h +++ b/src/mongo/db/session_killer.h @@ -30,6 +30,7 @@ #pragma once #include <boost/optional.hpp> +#include <functional> #include <memory> #include <random> #include <vector> @@ -37,7 +38,6 @@ #include "mongo/base/status_with.h" #include "mongo/db/kill_sessions.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/stdx/unordered_set.h" @@ -91,7 +91,7 @@ public: * A process specific kill function (we have a different impl in mongos versus mongod). */ using KillFunc = - stdx::function<Result(OperationContext*, const Matcher&, UniformRandomBitGenerator* urbg)>; + std::function<Result(OperationContext*, const Matcher&, UniformRandomBitGenerator* urbg)>; /** * The killer lives as a decoration on the service context. diff --git a/src/mongo/db/sessions_collection.cpp b/src/mongo/db/sessions_collection.cpp index 37e1749fefe..73ffa21fb0b 100644 --- a/src/mongo/db/sessions_collection.cpp +++ b/src/mongo/db/sessions_collection.cpp @@ -31,6 +31,7 @@ #include "mongo/db/sessions_collection.h" +#include <functional> #include <memory> #include <vector> @@ -41,7 +42,6 @@ #include "mongo/db/ops/write_ops.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/write_ops/batched_command_response.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/sessions_collection.h b/src/mongo/db/sessions_collection.h index 91ae86e7c9f..7eeaaf0dada 100644 --- a/src/mongo/db/sessions_collection.h +++ b/src/mongo/db/sessions_collection.h @@ -29,8 +29,9 @@ #pragma once +#include <functional> + #include "mongo/db/logical_session_id.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -100,11 +101,11 @@ protected: /** * Makes a send function for the given client. */ - using SendBatchFn = stdx::function<Status(BSONObj batch)>; + using SendBatchFn = std::function<Status(BSONObj batch)>; static SendBatchFn makeSendFnForCommand(const NamespaceString& ns, DBClientBase* client); static SendBatchFn makeSendFnForBatchWrite(const NamespaceString& ns, DBClientBase* client); - using FindBatchFn = stdx::function<StatusWith<BSONObj>(BSONObj batch)>; + using FindBatchFn = std::function<StatusWith<BSONObj>(BSONObj batch)>; static FindBatchFn makeFindFnForCommand(const NamespaceString& ns, DBClientBase* client); /** diff --git a/src/mongo/db/sessions_collection_mock.cpp b/src/mongo/db/sessions_collection_mock.cpp index de53f9a30ce..33e75ab842c 100644 --- a/src/mongo/db/sessions_collection_mock.cpp +++ b/src/mongo/db/sessions_collection_mock.cpp @@ -27,9 +27,10 @@ * it in the license file. */ +#include <functional> + #include "mongo/db/sessions_collection_mock.h" #include "mongo/platform/basic.h" -#include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/sessions_collection_mock.h b/src/mongo/db/sessions_collection_mock.h index 4f0f3e408c4..a31a4f7fc5a 100644 --- a/src/mongo/db/sessions_collection_mock.h +++ b/src/mongo/db/sessions_collection_mock.h @@ -29,9 +29,10 @@ #pragma once +#include <functional> + #include "mongo/db/logical_session_id.h" #include "mongo/db/sessions_collection.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" @@ -59,8 +60,8 @@ public: MockSessionsCollectionImpl(); - using RefreshHook = stdx::function<Status(const LogicalSessionRecordSet&)>; - using RemoveHook = stdx::function<Status(const LogicalSessionIdSet&)>; + using RefreshHook = std::function<Status(const LogicalSessionRecordSet&)>; + using RemoveHook = std::function<Status(const LogicalSessionIdSet&)>; // Set custom hooks to override default behavior void setRefreshHook(RefreshHook hook); diff --git a/src/mongo/db/storage/biggie/biggie_recovery_unit.cpp b/src/mongo/db/storage/biggie/biggie_recovery_unit.cpp index cd7026562a6..67479c0ea74 100644 --- a/src/mongo/db/storage/biggie/biggie_recovery_unit.cpp +++ b/src/mongo/db/storage/biggie/biggie_recovery_unit.cpp @@ -40,7 +40,7 @@ namespace mongo { namespace biggie { -RecoveryUnit::RecoveryUnit(KVEngine* parentKVEngine, stdx::function<void()> cb) +RecoveryUnit::RecoveryUnit(KVEngine* parentKVEngine, std::function<void()> cb) : _waitUntilDurableCallback(cb), _KVEngine(parentKVEngine) {} RecoveryUnit::~RecoveryUnit() { diff --git a/src/mongo/db/storage/biggie/biggie_recovery_unit.h b/src/mongo/db/storage/biggie/biggie_recovery_unit.h index 1db70102318..33403656f4a 100644 --- a/src/mongo/db/storage/biggie/biggie_recovery_unit.h +++ b/src/mongo/db/storage/biggie/biggie_recovery_unit.h @@ -29,20 +29,20 @@ #pragma once +#include <functional> #include <vector> #include "mongo/db/record_id.h" #include "mongo/db/storage/biggie/biggie_kv_engine.h" #include "mongo/db/storage/biggie/store.h" #include "mongo/db/storage/recovery_unit.h" -#include "mongo/stdx/functional.h" namespace mongo { namespace biggie { class RecoveryUnit : public ::mongo::RecoveryUnit { public: - RecoveryUnit(KVEngine* parentKVEngine, stdx::function<void()> cb = nullptr); + RecoveryUnit(KVEngine* parentKVEngine, std::function<void()> cb = nullptr); ~RecoveryUnit(); void beginUnitOfWork(OperationContext* opCtx) override final; @@ -80,7 +80,7 @@ public: private: void _abort(); - stdx::function<void()> _waitUntilDurableCallback; + std::function<void()> _waitUntilDurableCallback; // Official master is kept by KVEngine KVEngine* _KVEngine; StringStore _mergeBase; diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h index 4f2e11ead6e..7d5f7bf607a 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h @@ -29,11 +29,11 @@ #pragma once +#include <functional> #include <vector> #include "mongo/db/record_id.h" #include "mongo/db/storage/recovery_unit.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -41,7 +41,7 @@ class SortedDataInterface; class EphemeralForTestRecoveryUnit : public RecoveryUnit { public: - EphemeralForTestRecoveryUnit(stdx::function<void()> cb = nullptr) + EphemeralForTestRecoveryUnit(std::function<void()> cb = nullptr) : _waitUntilDurableCallback(cb) {} void beginUnitOfWork(OperationContext* opCtx) final{}; @@ -96,7 +96,7 @@ private: typedef std::vector<ChangePtr> Changes; Changes _changes; - stdx::function<void()> _waitUntilDurableCallback; + std::function<void()> _waitUntilDurableCallback; Timestamp _prepareTimestamp = Timestamp::min(); Timestamp _commitTimestamp = Timestamp::min(); diff --git a/src/mongo/db/storage/key_string_test.cpp b/src/mongo/db/storage/key_string_test.cpp index 57ce40f4563..bb231aada9f 100644 --- a/src/mongo/db/storage/key_string_test.cpp +++ b/src/mongo/db/storage/key_string_test.cpp @@ -33,6 +33,7 @@ #include <algorithm> #include <cmath> +#include <functional> #include <limits> #include <memory> #include <random> @@ -46,7 +47,6 @@ #include "mongo/config.h" #include "mongo/db/storage/key_string.h" #include "mongo/platform/decimal128.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/future.h" #include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp index 6cbb5572554..4801bc2c1dd 100644 --- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp +++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp @@ -133,7 +133,7 @@ public: std::vector<std::string> droppedIdents; // Override to modify dropIdent() behavior. - using DropIdentFn = stdx::function<Status(OperationContext*, StringData)>; + using DropIdentFn = std::function<Status(OperationContext*, StringData)>; DropIdentFn dropIdentFn = [](OperationContext*, StringData) { return Status::OK(); }; }; diff --git a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp index 182eba1cd73..6ed9e6c9299 100644 --- a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp +++ b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp @@ -49,7 +49,7 @@ namespace { using std::unique_ptr; using std::string; -stdx::function<std::unique_ptr<KVHarnessHelper>()> basicFactory = +std::function<std::unique_ptr<KVHarnessHelper>()> basicFactory = []() -> std::unique_ptr<KVHarnessHelper> { fassertFailed(40355); }; class MyOperationContext : public OperationContextNoop { @@ -688,7 +688,7 @@ std::unique_ptr<KVHarnessHelper> KVHarnessHelper::create() { return basicFactory(); }; -void KVHarnessHelper::registerFactory(stdx::function<std::unique_ptr<KVHarnessHelper>()> factory) { +void KVHarnessHelper::registerFactory(std::function<std::unique_ptr<KVHarnessHelper>()> factory) { basicFactory = std::move(factory); }; diff --git a/src/mongo/db/storage/kv/kv_engine_test_harness.h b/src/mongo/db/storage/kv/kv_engine_test_harness.h index fda7a4ae6d8..ed2f5d66d14 100644 --- a/src/mongo/db/storage/kv/kv_engine_test_harness.h +++ b/src/mongo/db/storage/kv/kv_engine_test_harness.h @@ -29,10 +29,10 @@ #pragma once +#include <functional> #include <memory> #include "mongo/db/storage/kv/kv_engine.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -56,7 +56,7 @@ public: virtual KVEngine* restartEngine() = 0; static std::unique_ptr<KVHarnessHelper> create(); - static void registerFactory(stdx::function<std::unique_ptr<KVHarnessHelper>()> factory); + static void registerFactory(std::function<std::unique_ptr<KVHarnessHelper>()> factory); }; } // namespace mongo diff --git a/src/mongo/db/storage/kv/kv_storage_engine.h b/src/mongo/db/storage/kv/kv_storage_engine.h index 263c5cdde9e..14360bb7700 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine.h +++ b/src/mongo/db/storage/kv/kv_storage_engine.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <map> #include <string> @@ -44,7 +45,6 @@ #include "mongo/db/storage/record_store.h" #include "mongo/db/storage/storage_engine.h" #include "mongo/db/storage/temporary_record_store.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/periodic_runner.h" @@ -188,7 +188,7 @@ public: class TimestampListener { public: // Caller must ensure that the lifetime of the variables used in the callback are valid. - using Callback = stdx::function<void(Timestamp timestamp)>; + using Callback = std::function<void(Timestamp timestamp)>; /** * A TimestampListener saves a 'callback' that will be executed whenever the specified diff --git a/src/mongo/db/storage/storage_engine_init.cpp b/src/mongo/db/storage/storage_engine_init.cpp index fd7701b8c8d..66805071ca2 100644 --- a/src/mongo/db/storage/storage_engine_init.cpp +++ b/src/mongo/db/storage/storage_engine_init.cpp @@ -283,7 +283,7 @@ StorageEngine::Factory* getFactoryForStorageEngine(ServiceContext* service, Stri Status validateStorageOptions( ServiceContext* service, const BSONObj& storageEngineOptions, - stdx::function<Status(const StorageEngine::Factory* const, const BSONObj&)> validateFunc) { + std::function<Status(const StorageEngine::Factory* const, const BSONObj&)> validateFunc) { BSONObjIterator storageIt(storageEngineOptions); while (storageIt.more()) { diff --git a/src/mongo/db/storage/storage_engine_init.h b/src/mongo/db/storage/storage_engine_init.h index 793c698b74b..87d3af190ae 100644 --- a/src/mongo/db/storage/storage_engine_init.h +++ b/src/mongo/db/storage/storage_engine_init.h @@ -87,7 +87,7 @@ StorageEngine::Factory* getFactoryForStorageEngine(ServiceContext* context, Stri Status validateStorageOptions( ServiceContext* service, const BSONObj& storageEngineOptions, - stdx::function<Status(const StorageEngine::Factory* const, const BSONObj&)> validateFunc); + std::function<Status(const StorageEngine::Factory* const, const BSONObj&)> validateFunc); /* * Appends a the list of available storage engines to a BSONObjBuilder for reporting purposes. diff --git a/src/mongo/db/storage/test_harness_helper.cpp b/src/mongo/db/storage/test_harness_helper.cpp index 7391e6ea500..716029669a9 100644 --- a/src/mongo/db/storage/test_harness_helper.cpp +++ b/src/mongo/db/storage/test_harness_helper.cpp @@ -36,12 +36,12 @@ namespace mongo { namespace { -stdx::function<std::unique_ptr<HarnessHelper>()> basicHarnessFactory; +std::function<std::unique_ptr<HarnessHelper>()> basicHarnessFactory; } // namespace HarnessHelper::HarnessHelper() : _threadClient(getGlobalServiceContext()) {} -void registerHarnessHelperFactory(stdx::function<std::unique_ptr<HarnessHelper>()> factory) { +void registerHarnessHelperFactory(std::function<std::unique_ptr<HarnessHelper>()> factory) { basicHarnessFactory = std::move(factory); } diff --git a/src/mongo/db/storage/test_harness_helper.h b/src/mongo/db/storage/test_harness_helper.h index 2a04a8b773c..fb0d1974b1a 100644 --- a/src/mongo/db/storage/test_harness_helper.h +++ b/src/mongo/db/storage/test_harness_helper.h @@ -30,6 +30,7 @@ #pragma once #include <cstdint> +#include <functional> #include <initializer_list> #include <memory> @@ -39,7 +40,6 @@ #include "mongo/db/service_context.h" #include "mongo/db/service_context_test_fixture.h" #include "mongo/db/storage/sorted_data_interface.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/util/unowned_ptr.h" @@ -95,7 +95,7 @@ std::unique_ptr<Target> noexcept_ptr_conversion(std::unique_ptr<Current>&& p, Ta } } // namespace harness_helper_detail -extern void registerHarnessHelperFactory(stdx::function<std::unique_ptr<HarnessHelper>()> factory); +extern void registerHarnessHelperFactory(std::function<std::unique_ptr<HarnessHelper>()> factory); template <typename Target, typename Current> std::unique_ptr<Target> dynamic_ptr_cast(std::unique_ptr<Current>&& p) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index da7eeac9fb4..2c6728dfe88 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -501,7 +501,7 @@ Status OpenReadTransactionParam::setFromString(const std::string& str) { namespace { -stdx::function<bool(StringData)> initRsOplogBackgroundThreadCallback = [](StringData) -> bool { +std::function<bool(StringData)> initRsOplogBackgroundThreadCallback = [](StringData) -> bool { fassertFailed(40358); }; @@ -1556,7 +1556,7 @@ void WiredTigerKVEngine::setJournalListener(JournalListener* jl) { } void WiredTigerKVEngine::setInitRsOplogBackgroundThreadCallback( - stdx::function<bool(StringData)> cb) { + std::function<bool(StringData)> cb) { initRsOplogBackgroundThreadCallback = std::move(cb); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index 5ba3224b542..f6b2a7ecb8f 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <list> #include <memory> #include <string> @@ -43,7 +44,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/elapsed_tracker.h" @@ -295,7 +295,7 @@ public: * background job, for example). Intended to be called from a MONGO_INITIALIZER and therefore in * a single threaded context. */ - static void setInitRsOplogBackgroundThreadCallback(stdx::function<bool(StringData)> cb); + static void setInitRsOplogBackgroundThreadCallback(std::function<bool(StringData)> cb); /** * Initializes a background job to remove excess documents in the oplog collections. diff --git a/src/mongo/db/transaction_participant_retryable_writes_test.cpp b/src/mongo/db/transaction_participant_retryable_writes_test.cpp index 897c883c254..d5e0ded3338 100644 --- a/src/mongo/db/transaction_participant_retryable_writes_test.cpp +++ b/src/mongo/db/transaction_participant_retryable_writes_test.cpp @@ -101,7 +101,7 @@ public: bool onTransactionPrepareThrowsException = false; bool transactionPrepared = false; - stdx::function<void()> onTransactionPrepareFn = [this]() { transactionPrepared = true; }; + std::function<void()> onTransactionPrepareFn = [this]() { transactionPrepared = true; }; void onUnpreparedTransactionCommit( OperationContext* opCtx, const std::vector<repl::ReplOperation>& statements) override { @@ -118,7 +118,7 @@ public: bool onUnpreparedTransactionCommitThrowsException = false; bool unpreparedTransactionCommitted = false; - stdx::function<void()> onUnpreparedTransactionCommitFn = [this]() { + std::function<void()> onUnpreparedTransactionCommitFn = [this]() { unpreparedTransactionCommitted = true; }; @@ -141,7 +141,7 @@ public: bool onPreparedTransactionCommitThrowsException = false; bool preparedTransactionCommitted = false; - stdx::function<void(OplogSlot, Timestamp)> onPreparedTransactionCommitFn = + std::function<void(OplogSlot, Timestamp)> onPreparedTransactionCommitFn = [this](OplogSlot commitOplogEntryOpTime, Timestamp commitTimestamp) { preparedTransactionCommitted = true; }; diff --git a/src/mongo/db/transaction_participant_test.cpp b/src/mongo/db/transaction_participant_test.cpp index 82f68661e2d..5c27632ff13 100644 --- a/src/mongo/db/transaction_participant_test.cpp +++ b/src/mongo/db/transaction_participant_test.cpp @@ -1,5 +1,4 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. +/** * Copyright (C) 2018-present MongoDB, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the Server Side Public License, version 1, @@ -100,13 +99,13 @@ public: bool onTransactionPrepareThrowsException = false; bool transactionPrepared = false; - stdx::function<void()> onTransactionPrepareFn = []() {}; + std::function<void()> onTransactionPrepareFn = []() {}; void onUnpreparedTransactionCommit(OperationContext* opCtx, const std::vector<repl::ReplOperation>& statements) override; bool onUnpreparedTransactionCommitThrowsException = false; bool unpreparedTransactionCommitted = false; - stdx::function<void(const std::vector<repl::ReplOperation>&)> onUnpreparedTransactionCommitFn = + std::function<void(const std::vector<repl::ReplOperation>&)> onUnpreparedTransactionCommitFn = [](const std::vector<repl::ReplOperation>& statements) {}; @@ -117,7 +116,7 @@ public: const std::vector<repl::ReplOperation>& statements) noexcept override; bool onPreparedTransactionCommitThrowsException = false; bool preparedTransactionCommitted = false; - stdx::function<void(OplogSlot, Timestamp, const std::vector<repl::ReplOperation>&)> + std::function<void(OplogSlot, Timestamp, const std::vector<repl::ReplOperation>&)> onPreparedTransactionCommitFn = [](OplogSlot commitOplogEntryOpTime, Timestamp commitTimestamp, const std::vector<repl::ReplOperation>& statements) {}; diff --git a/src/mongo/db/views/durable_view_catalog.h b/src/mongo/db/views/durable_view_catalog.h index 69086909379..41c2f5837c3 100644 --- a/src/mongo/db/views/durable_view_catalog.h +++ b/src/mongo/db/views/durable_view_catalog.h @@ -29,12 +29,12 @@ #pragma once +#include <functional> #include <string> #include "mongo/base/status.h" #include "mongo/base/string_data.h" #include "mongo/db/namespace_string.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -59,7 +59,7 @@ public: */ static void onExternalChange(OperationContext* opCtx, const NamespaceString& name); - using Callback = stdx::function<Status(const BSONObj& view)>; + using Callback = std::function<Status(const BSONObj& view)>; virtual Status iterate(OperationContext* opCtx, Callback callback) = 0; virtual void upsert(OperationContext* opCtx, const NamespaceString& name, diff --git a/src/mongo/db/views/view_catalog.h b/src/mongo/db/views/view_catalog.h index 7e92ea3afad..05509f5e2fb 100644 --- a/src/mongo/db/views/view_catalog.h +++ b/src/mongo/db/views/view_catalog.h @@ -29,6 +29,7 @@ #pragma once +#include <functional> #include <map> #include <memory> #include <string> @@ -43,7 +44,6 @@ #include "mongo/db/views/resolved_view.h" #include "mongo/db/views/view.h" #include "mongo/db/views/view_graph.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/with_lock.h" #include "mongo/util/string_map.h" @@ -65,7 +65,7 @@ class ViewCatalog { public: using ViewMap = StringMap<std::shared_ptr<ViewDefinition>>; - using ViewIteratorCallback = stdx::function<void(const ViewDefinition& view)>; + using ViewIteratorCallback = std::function<void(const ViewDefinition& view)>; static ViewCatalog* get(const Database* db); static void set(Database* db, std::unique_ptr<ViewCatalog> catalog); diff --git a/src/mongo/db/views/view_catalog_test.cpp b/src/mongo/db/views/view_catalog_test.cpp index 65142d33cd3..b9c82fc1a36 100644 --- a/src/mongo/db/views/view_catalog_test.cpp +++ b/src/mongo/db/views/view_catalog_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <functional> #include <memory> #include <set> @@ -50,7 +51,6 @@ #include "mongo/db/views/view.h" #include "mongo/db/views/view_catalog.h" #include "mongo/db/views/view_graph.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/str.h" @@ -78,7 +78,7 @@ public: explicit DurableViewCatalogDummy() : _upsertCount(0), _iterateCount(0) {} static const std::string name; - using Callback = stdx::function<Status(const BSONObj& view)>; + using Callback = std::function<Status(const BSONObj& view)>; virtual Status iterate(OperationContext* opCtx, Callback callback) { ++_iterateCount; return Status::OK(); diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp index adcb5ca3fb1..41ca3fb7a14 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp @@ -125,7 +125,7 @@ string MockDBClientConnection::toString() const { } unsigned long long MockDBClientConnection::query( - stdx::function<void(mongo::DBClientCursorBatchIterator&)> f, + std::function<void(mongo::DBClientCursorBatchIterator&)> f, const NamespaceStringOrUUID& nsOrUuid, mongo::Query query, const mongo::BSONObj* fieldsToReturn, diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h index afed04c393d..8995e92ab19 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.h +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h @@ -104,7 +104,7 @@ public: // Unsupported methods (defined to get rid of virtual function was hidden error) // - unsigned long long query(stdx::function<void(mongo::DBClientCursorBatchIterator&)> f, + unsigned long long query(std::function<void(mongo::DBClientCursorBatchIterator&)> f, const NamespaceStringOrUUID& nsOrUuid, mongo::Query query, const mongo::BSONObj* fieldsToReturn = 0, diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp index 5cef4ec9af2..1dd468576eb 100644 --- a/src/mongo/dbtests/threadedtests.cpp +++ b/src/mongo/dbtests/threadedtests.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include <boost/version.hpp> +#include <functional> #include <iostream> #include "mongo/config.h" @@ -39,7 +40,6 @@ #include "mongo/dbtests/dbtests.h" #include "mongo/platform/atomic_word.h" #include "mongo/platform/bits.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/concurrency/ticketholder.h" diff --git a/src/mongo/executor/async_timer_interface.h b/src/mongo/executor/async_timer_interface.h index d57cac90bf0..e70b5b23699 100644 --- a/src/mongo/executor/async_timer_interface.h +++ b/src/mongo/executor/async_timer_interface.h @@ -29,9 +29,9 @@ #pragma once +#include <functional> #include <system_error> -#include "mongo/stdx/functional.h" #include "mongo/util/time_support.h" namespace mongo { @@ -47,7 +47,7 @@ class AsyncTimerInterface { public: virtual ~AsyncTimerInterface() = default; - using Handler = stdx::function<void(std::error_code)>; + using Handler = std::function<void(std::error_code)>; /** * Cancel any asynchronous operations waiting on this timer, invoking diff --git a/src/mongo/executor/connection_pool.cpp b/src/mongo/executor/connection_pool.cpp index 3c4454110c4..e55f9830394 100644 --- a/src/mongo/executor/connection_pool.cpp +++ b/src/mongo/executor/connection_pool.cpp @@ -183,8 +183,8 @@ public: /** * Atomically manipulate the tags in the pool */ - void mutateTags(const stdx::function<transport::Session::TagMask(transport::Session::TagMask)>& - mutateFunc) { + void mutateTags( + const std::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc) { _tags = mutateFunc(_tags); } @@ -365,7 +365,7 @@ void ConnectionPool::dropConnections(transport::Session::TagMask tags) { void ConnectionPool::mutateTags( const HostAndPort& hostAndPort, - const stdx::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc) { + const std::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc) { stdx::lock_guard lk(_mutex); auto iter = _pools.find(hostAndPort); diff --git a/src/mongo/executor/connection_pool.h b/src/mongo/executor/connection_pool.h index 9fb22e2c71e..340d36b2145 100644 --- a/src/mongo/executor/connection_pool.h +++ b/src/mongo/executor/connection_pool.h @@ -29,12 +29,12 @@ #pragma once +#include <functional> #include <memory> #include <queue> #include "mongo/executor/egress_tag_closer.h" #include "mongo/executor/egress_tag_closer_manager.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/transport/session.h" @@ -70,7 +70,7 @@ public: class DependentTypeFactoryInterface; class TimerInterface; - using ConnectionHandleDeleter = stdx::function<void(ConnectionInterface* connection)>; + using ConnectionHandleDeleter = std::function<void(ConnectionInterface* connection)>; using ConnectionHandle = std::unique_ptr<ConnectionInterface, ConnectionHandleDeleter>; using GetConnectionCallback = unique_function<void(StatusWith<ConnectionHandle>)>; @@ -152,7 +152,7 @@ public: void dropConnections(transport::Session::TagMask tags) override; void mutateTags(const HostAndPort& hostAndPort, - const stdx::function<transport::Session::TagMask(transport::Session::TagMask)>& + const std::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc) override; SemiFuture<ConnectionHandle> get(const HostAndPort& hostAndPort, @@ -194,7 +194,7 @@ class ConnectionPool::TimerInterface { public: TimerInterface() = default; - using TimeoutCallback = stdx::function<void()>; + using TimeoutCallback = std::function<void()>; virtual ~TimerInterface() = default; diff --git a/src/mongo/executor/egress_tag_closer.h b/src/mongo/executor/egress_tag_closer.h index 62448950c0e..b1ab2430ed6 100644 --- a/src/mongo/executor/egress_tag_closer.h +++ b/src/mongo/executor/egress_tag_closer.h @@ -29,7 +29,8 @@ #pragma once -#include "mongo/stdx/functional.h" +#include <functional> + #include "mongo/transport/session.h" #include "mongo/util/net/hostandport.h" @@ -50,7 +51,7 @@ public: virtual void dropConnections(const HostAndPort& hostAndPort) = 0; virtual void mutateTags(const HostAndPort& hostAndPort, - const stdx::function<transport::Session::TagMask( + const std::function<transport::Session::TagMask( transport::Session::TagMask)>& mutateFunc) = 0; protected: diff --git a/src/mongo/executor/egress_tag_closer_manager.cpp b/src/mongo/executor/egress_tag_closer_manager.cpp index 5ec544843f5..fa78a74e183 100644 --- a/src/mongo/executor/egress_tag_closer_manager.cpp +++ b/src/mongo/executor/egress_tag_closer_manager.cpp @@ -77,7 +77,7 @@ void EgressTagCloserManager::dropConnections(const HostAndPort& hostAndPort) { void EgressTagCloserManager::mutateTags( const HostAndPort& hostAndPort, - const stdx::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc) { + const std::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc) { stdx::lock_guard<stdx::mutex> lk(_mutex); for (auto etc : _egressTagClosers) { diff --git a/src/mongo/executor/egress_tag_closer_manager.h b/src/mongo/executor/egress_tag_closer_manager.h index 0899b915389..418658dc430 100644 --- a/src/mongo/executor/egress_tag_closer_manager.h +++ b/src/mongo/executor/egress_tag_closer_manager.h @@ -29,9 +29,10 @@ #pragma once +#include <functional> + #include "mongo/db/service_context.h" #include "mongo/executor/egress_tag_closer.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_set.h" #include "mongo/transport/session.h" @@ -61,7 +62,7 @@ public: void mutateTags( const HostAndPort& hostAndPort, - const stdx::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc); + const std::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc); private: stdx::mutex _mutex; diff --git a/src/mongo/executor/network_interface.h b/src/mongo/executor/network_interface.h index 8bc864e3df6..6f938efb3a1 100644 --- a/src/mongo/executor/network_interface.h +++ b/src/mongo/executor/network_interface.h @@ -30,10 +30,10 @@ #pragma once #include <boost/optional.hpp> +#include <functional> #include <string> #include "mongo/executor/task_executor.h" -#include "mongo/stdx/functional.h" #include "mongo/transport/baton.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/functional.h" diff --git a/src/mongo/executor/network_interface_integration_fixture.h b/src/mongo/executor/network_interface_integration_fixture.h index 704c9b7b124..15c1a9f4361 100644 --- a/src/mongo/executor/network_interface_integration_fixture.h +++ b/src/mongo/executor/network_interface_integration_fixture.h @@ -59,7 +59,7 @@ inline TaskExecutor::CallbackHandle makeCallbackHandle() { return TaskExecutor::CallbackHandle(std::make_shared<MockCallbackState>()); } -using StartCommandCB = stdx::function<void(const RemoteCommandResponse&)>; +using StartCommandCB = std::function<void(const RemoteCommandResponse&)>; class NetworkInterfaceIntegrationFixture : public mongo::unittest::Test { public: diff --git a/src/mongo/executor/network_interface_mock.cpp b/src/mongo/executor/network_interface_mock.cpp index 7f156744803..da9aa915b54 100644 --- a/src/mongo/executor/network_interface_mock.cpp +++ b/src/mongo/executor/network_interface_mock.cpp @@ -31,14 +31,14 @@ #include "mongo/platform/basic.h" -#include "mongo/executor/network_connection_hook.h" #include "mongo/executor/network_interface_mock.h" #include <algorithm> +#include <functional> #include <iterator> #include "mongo/executor/connection_pool_stats.h" -#include "mongo/stdx/functional.h" +#include "mongo/executor/network_connection_hook.h" #include "mongo/util/log.h" #include "mongo/util/str.h" #include "mongo/util/time_support.h" diff --git a/src/mongo/executor/network_interface_perf_test.cpp b/src/mongo/executor/network_interface_perf_test.cpp index 66ad4c596df..29eb7ebb84c 100644 --- a/src/mongo/executor/network_interface_perf_test.cpp +++ b/src/mongo/executor/network_interface_perf_test.cpp @@ -72,7 +72,7 @@ int timeNetworkTestMillis(std::size_t operations, NetworkInterface* net) { // This lambda function is declared here since it is mutually recursive with another callback // function - stdx::function<void()> func; + std::function<void()> func; const auto bsonObjPing = BSON("ping" << 1); diff --git a/src/mongo/executor/network_test_env.h b/src/mongo/executor/network_test_env.h index 5125b7b4bd5..25025e39c16 100644 --- a/src/mongo/executor/network_test_env.h +++ b/src/mongo/executor/network_test_env.h @@ -29,13 +29,13 @@ #pragma once +#include <functional> #include <tuple> #include <type_traits> #include <vector> #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/task_executor.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/future.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" @@ -157,16 +157,16 @@ public: std::move(future), _executor, _mockNetwork}; } - using OnCommandFunction = stdx::function<StatusWith<BSONObj>(const RemoteCommandRequest&)>; + using OnCommandFunction = std::function<StatusWith<BSONObj>(const RemoteCommandRequest&)>; using OnCommandWithMetadataFunction = - stdx::function<RemoteCommandResponse(const RemoteCommandRequest&)>; + std::function<RemoteCommandResponse(const RemoteCommandRequest&)>; using OnFindCommandFunction = - stdx::function<StatusWith<std::vector<BSONObj>>(const RemoteCommandRequest&)>; + std::function<StatusWith<std::vector<BSONObj>>(const RemoteCommandRequest&)>; // Function that accepts a find request and returns a tuple of resulting documents and response // metadata. using OnFindCommandWithMetadataFunction = - stdx::function<StatusWith<std::tuple<std::vector<BSONObj>, BSONObj>>( + std::function<StatusWith<std::tuple<std::vector<BSONObj>, BSONObj>>( const RemoteCommandRequest&)>; /** diff --git a/src/mongo/executor/task_executor.h b/src/mongo/executor/task_executor.h index cb1b2f00cef..92aad54a22a 100644 --- a/src/mongo/executor/task_executor.h +++ b/src/mongo/executor/task_executor.h @@ -39,7 +39,6 @@ #include "mongo/executor/remote_command_request.h" #include "mongo/executor/remote_command_response.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/transport/baton.h" #include "mongo/util/future.h" #include "mongo/util/out_of_line_executor.h" @@ -106,10 +105,9 @@ public: * the BSONObj returned by the command, with the "ok" field indicating the success of the * command in the usual way. */ - using RemoteCommandCallbackFn = stdx::function<void(const RemoteCommandCallbackArgs&)>; + using RemoteCommandCallbackFn = std::function<void(const RemoteCommandCallbackArgs&)>; - using RemoteCommandOnAnyCallbackFn = - stdx::function<void(const RemoteCommandOnAnyCallbackArgs&)>; + using RemoteCommandOnAnyCallbackFn = std::function<void(const RemoteCommandOnAnyCallbackArgs&)>; /** * Destroys the task executor. Implicitly performs the equivalent of shutdown() and join() diff --git a/src/mongo/executor/task_executor_test_common.cpp b/src/mongo/executor/task_executor_test_common.cpp index f98e71e5736..cd38281d267 100644 --- a/src/mongo/executor/task_executor_test_common.cpp +++ b/src/mongo/executor/task_executor_test_common.cpp @@ -53,7 +53,7 @@ namespace executor { namespace { using ExecutorFactory = - stdx::function<std::unique_ptr<TaskExecutor>(std::unique_ptr<NetworkInterfaceMock>)>; + std::function<std::unique_ptr<TaskExecutor>(std::unique_ptr<NetworkInterfaceMock>)>; class CommonTaskExecutorTestFixture : public TaskExecutorTest { public: @@ -70,7 +70,7 @@ private: }; using ExecutorTestCaseFactory = - stdx::function<std::unique_ptr<CommonTaskExecutorTestFixture>(ExecutorFactory)>; + std::function<std::unique_ptr<CommonTaskExecutorTestFixture>(ExecutorFactory)>; using ExecutorTestCaseMap = stdx::unordered_map<std::string, ExecutorTestCaseFactory>; static ExecutorTestCaseMap& executorTestCaseRegistry() { diff --git a/src/mongo/executor/task_executor_test_common.h b/src/mongo/executor/task_executor_test_common.h index ba8c9ceb967..1cb87db0422 100644 --- a/src/mongo/executor/task_executor_test_common.h +++ b/src/mongo/executor/task_executor_test_common.h @@ -29,11 +29,10 @@ #pragma once +#include <functional> #include <memory> #include <string> -#include "mongo/stdx/functional.h" - namespace mongo { namespace executor { @@ -51,7 +50,7 @@ class TaskExecutor; * by value. */ void addTestsForExecutor(const std::string& suiteName, - stdx::function<std::unique_ptr<TaskExecutor>( + std::function<std::unique_ptr<TaskExecutor>( std::unique_ptr<NetworkInterfaceMock>)> makeExecutor); } // namespace executor diff --git a/src/mongo/executor/thread_pool_mock.h b/src/mongo/executor/thread_pool_mock.h index e3baaa07273..e1f8e30a80f 100644 --- a/src/mongo/executor/thread_pool_mock.h +++ b/src/mongo/executor/thread_pool_mock.h @@ -30,10 +30,10 @@ #pragma once #include <cstdint> +#include <functional> #include <vector> #include "mongo/platform/random.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/thread_pool_interface.h" @@ -56,7 +56,7 @@ public: */ struct Options { // This function is run before the worker thread begins consuming tasks. - using OnCreateThreadFn = stdx::function<void()>; + using OnCreateThreadFn = std::function<void()>; OnCreateThreadFn onCreateThread = []() {}; }; diff --git a/src/mongo/rpc/metadata.h b/src/mongo/rpc/metadata.h index bfa9152e083..388434b58dd 100644 --- a/src/mongo/rpc/metadata.h +++ b/src/mongo/rpc/metadata.h @@ -29,11 +29,11 @@ #pragma once +#include <functional> #include <tuple> #include "mongo/base/status_with.h" #include "mongo/rpc/op_msg.h" -#include "mongo/stdx/functional.h" namespace mongo { class BSONObj; @@ -74,7 +74,7 @@ OpMsgRequest upconvertRequest(StringData db, BSONObj legacyCmdObj, int queryFlag * metadata was written successfully. */ using RequestMetadataWriter = - stdx::function<Status(OperationContext* opCtx, BSONObjBuilder* metadataBuilder)>; + std::function<Status(OperationContext* opCtx, BSONObjBuilder* metadataBuilder)>; /** * A function type for reading reply metadata. The function takes a a reference to a @@ -84,7 +84,7 @@ using RequestMetadataWriter = * * TODO: would it be a layering violation if this hook took an OperationContext* ? */ -using ReplyMetadataReader = stdx::function<Status( +using ReplyMetadataReader = std::function<Status( OperationContext* opCtx, const BSONObj& replyMetadata, StringData sourceHost)>; } // namespace rpc diff --git a/src/mongo/s/catalog/dist_lock_catalog_mock.h b/src/mongo/s/catalog/dist_lock_catalog_mock.h index d8b9a5a42bc..4fd6562cdc5 100644 --- a/src/mongo/s/catalog/dist_lock_catalog_mock.h +++ b/src/mongo/s/catalog/dist_lock_catalog_mock.h @@ -29,11 +29,12 @@ #pragma once +#include <functional> + #include "mongo/base/status_with.h" #include "mongo/s/catalog/dist_lock_catalog.h" #include "mongo/s/catalog/type_lockpings.h" #include "mongo/s/catalog/type_locks.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { @@ -69,26 +70,26 @@ public: DistLockCatalogMock(); virtual ~DistLockCatalogMock(); - using GrabLockFunc = stdx::function<void(StringData lockID, - const OID& lockSessionID, - StringData who, - StringData processId, - Date_t time, - StringData why)>; - using OvertakeLockFunc = stdx::function<void(StringData lockID, - const OID& lockSessionID, - const OID& currentHolderTS, - StringData who, - StringData processId, - Date_t time, - StringData why)>; - using UnlockFunc = stdx::function<void(const OID& lockSessionID)>; - using PingFunc = stdx::function<void(StringData processID, Date_t ping)>; - using StopPingFunc = stdx::function<void(StringData processID)>; + using GrabLockFunc = std::function<void(StringData lockID, + const OID& lockSessionID, + StringData who, + StringData processId, + Date_t time, + StringData why)>; + using OvertakeLockFunc = std::function<void(StringData lockID, + const OID& lockSessionID, + const OID& currentHolderTS, + StringData who, + StringData processId, + Date_t time, + StringData why)>; + using UnlockFunc = std::function<void(const OID& lockSessionID)>; + using PingFunc = std::function<void(StringData processID, Date_t ping)>; + using StopPingFunc = std::function<void(StringData processID)>; using GetPingFunc = StopPingFunc; - using GetLockByTSFunc = stdx::function<void(const OID& ts)>; - using GetLockByNameFunc = stdx::function<void(StringData name)>; - using GetServerInfoFunc = stdx::function<void()>; + using GetLockByTSFunc = std::function<void(const OID& ts)>; + using GetLockByNameFunc = std::function<void(StringData name)>; + using GetServerInfoFunc = std::function<void()>; virtual StatusWith<LockpingsType> getPing(OperationContext* opCtx, StringData processID) override; diff --git a/src/mongo/s/catalog/dist_lock_manager_mock.h b/src/mongo/s/catalog/dist_lock_manager_mock.h index 7c2ad8a07ef..bf8081b50c5 100644 --- a/src/mongo/s/catalog/dist_lock_manager_mock.h +++ b/src/mongo/s/catalog/dist_lock_manager_mock.h @@ -29,12 +29,12 @@ #pragma once +#include <functional> #include <string> #include <vector> #include "mongo/s/catalog/dist_lock_catalog.h" #include "mongo/s/catalog/dist_lock_manager.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -63,7 +63,7 @@ public: void unlockAll(OperationContext* opCtx, const std::string& processID) override; using LockFunc = - stdx::function<void(StringData name, StringData whyMessage, Milliseconds waitFor)>; + std::function<void(StringData name, StringData whyMessage, Milliseconds waitFor)>; void expectLock(LockFunc checkerFunc, Status lockStatus); diff --git a/src/mongo/s/catalog_cache_loader.h b/src/mongo/s/catalog_cache_loader.h index cb00ae17bac..16276074373 100644 --- a/src/mongo/s/catalog_cache_loader.h +++ b/src/mongo/s/catalog_cache_loader.h @@ -91,7 +91,7 @@ public: }; using GetChunksSinceCallbackFn = - stdx::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)>; + std::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)>; /** * Initializes internal state. Must be called only once when sharding state is initialized. @@ -141,7 +141,7 @@ public: */ virtual void getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) = 0; + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) = 0; /** * Waits for any pending changes for the specified collection to be persisted locally (not diff --git a/src/mongo/s/client/shard_factory.h b/src/mongo/s/client/shard_factory.h index c830a470fda..bbd07b061f9 100644 --- a/src/mongo/s/client/shard_factory.h +++ b/src/mongo/s/client/shard_factory.h @@ -34,11 +34,9 @@ #include <memory> #include <string> - #include "mongo/client/connection_string.h" #include "mongo/client/remote_command_targeter_factory.h" #include "mongo/s/client/shard.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -51,7 +49,7 @@ class ShardFactory { public: using BuilderCallable = - stdx::function<std::unique_ptr<Shard>(const ShardId&, const ConnectionString&)>; + std::function<std::unique_ptr<Shard>(const ShardId&, const ConnectionString&)>; using BuildersMap = std::map<ConnectionString::ConnectionType, BuilderCallable>; ShardFactory(BuildersMap&&, std::unique_ptr<RemoteCommandTargeterFactory>); diff --git a/src/mongo/s/commands/cluster_command_test_fixture.h b/src/mongo/s/commands/cluster_command_test_fixture.h index 97739c7ef18..9c5406c073b 100644 --- a/src/mongo/s/commands/cluster_command_test_fixture.h +++ b/src/mongo/s/commands/cluster_command_test_fixture.h @@ -36,7 +36,7 @@ namespace mongo { -using InspectionCallback = stdx::function<void(const executor::RemoteCommandRequest& request)>; +using InspectionCallback = std::function<void(const executor::RemoteCommandRequest& request)>; class ClusterCommandTestFixture : public CatalogCacheTestFixture { protected: diff --git a/src/mongo/s/config_server_catalog_cache_loader.cpp b/src/mongo/s/config_server_catalog_cache_loader.cpp index 0776a4c3626..c97856075e6 100644 --- a/src/mongo/s/config_server_catalog_cache_loader.cpp +++ b/src/mongo/s/config_server_catalog_cache_loader.cpp @@ -198,7 +198,7 @@ std::shared_ptr<Notification<void>> ConfigServerCatalogCacheLoader::getChunksSin void ConfigServerCatalogCacheLoader::getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { _threadPool.schedule([ name = dbName.toString(), callbackFn ](auto status) noexcept { invariant(status); diff --git a/src/mongo/s/config_server_catalog_cache_loader.h b/src/mongo/s/config_server_catalog_cache_loader.h index 56cb65528c0..d70c86f0d88 100644 --- a/src/mongo/s/config_server_catalog_cache_loader.h +++ b/src/mongo/s/config_server_catalog_cache_loader.h @@ -56,7 +56,7 @@ public: void getDatabase( StringData dbName, - stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) override; + std::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) override; private: // Thread pool to be used to perform metadata load diff --git a/src/mongo/s/grid.h b/src/mongo/s/grid.h index 794a93f262f..db9a3fbad89 100644 --- a/src/mongo/s/grid.h +++ b/src/mongo/s/grid.h @@ -29,11 +29,12 @@ #pragma once +#include <functional> + #include "mongo/db/repl/optime.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_registry.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" @@ -58,7 +59,7 @@ public: Grid(); ~Grid(); - using CustomConnectionPoolStatsFn = stdx::function<void(executor::ConnectionPoolStats* stats)>; + using CustomConnectionPoolStatsFn = std::function<void(executor::ConnectionPoolStats* stats)>; /** * Retrieves the instance of Grid associated with the current service/operation context. diff --git a/src/mongo/s/query/cluster_client_cursor_mock.cpp b/src/mongo/s/query/cluster_client_cursor_mock.cpp index cce3f218477..499cacdf81d 100644 --- a/src/mongo/s/query/cluster_client_cursor_mock.cpp +++ b/src/mongo/s/query/cluster_client_cursor_mock.cpp @@ -39,7 +39,7 @@ namespace mongo { ClusterClientCursorMock::ClusterClientCursorMock(boost::optional<LogicalSessionId> lsid, boost::optional<TxnNumber> txnNumber, - stdx::function<void(void)> killCallback) + std::function<void(void)> killCallback) : _killCallback(std::move(killCallback)), _lsid(lsid), _txnNumber(txnNumber) {} ClusterClientCursorMock::~ClusterClientCursorMock() { diff --git a/src/mongo/s/query/cluster_client_cursor_mock.h b/src/mongo/s/query/cluster_client_cursor_mock.h index f99d2e77b94..783a038eea1 100644 --- a/src/mongo/s/query/cluster_client_cursor_mock.h +++ b/src/mongo/s/query/cluster_client_cursor_mock.h @@ -29,13 +29,12 @@ #pragma once -#include <queue> - #include <boost/optional.hpp> +#include <functional> +#include <queue> #include "mongo/db/logical_session_id.h" #include "mongo/s/query/cluster_client_cursor.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -46,7 +45,7 @@ class ClusterClientCursorMock final : public ClusterClientCursor { public: ClusterClientCursorMock(boost::optional<LogicalSessionId> lsid, boost::optional<TxnNumber> txnNumber, - stdx::function<void(void)> killCallback = stdx::function<void(void)>()); + std::function<void(void)> killCallback = {}); ~ClusterClientCursorMock(); @@ -118,7 +117,7 @@ private: bool _killed = false; bool _exhausted = false; std::queue<StatusWith<ClusterQueryResult>> _resultsQueue; - stdx::function<void(void)> _killCallback; + std::function<void(void)> _killCallback; // Originating command object. BSONObj _originatingCommand; diff --git a/src/mongo/s/sharding_initialization.h b/src/mongo/s/sharding_initialization.h index e3e7acce876..2121c119007 100644 --- a/src/mongo/s/sharding_initialization.h +++ b/src/mongo/s/sharding_initialization.h @@ -30,10 +30,10 @@ #pragma once #include <boost/optional.hpp> +#include <functional> #include "mongo/base/string_data.h" #include "mongo/bson/oid.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" namespace mongo { @@ -52,7 +52,7 @@ class TaskExecutor; namespace rpc { class EgressMetadataHook; -using ShardingEgressMetadataHookBuilder = stdx::function<std::unique_ptr<EgressMetadataHook>()>; +using ShardingEgressMetadataHookBuilder = std::function<std::unique_ptr<EgressMetadataHook>()>; } // namespace rpc /** diff --git a/src/mongo/scripting/bson_template_evaluator.h b/src/mongo/scripting/bson_template_evaluator.h index 6d2f0565790..90fb9fe5b6f 100644 --- a/src/mongo/scripting/bson_template_evaluator.h +++ b/src/mongo/scripting/bson_template_evaluator.h @@ -44,12 +44,12 @@ */ #pragma once +#include <functional> #include <map> #include <string> #include "mongo/db/jsobj.h" #include "mongo/platform/random.h" -#include "mongo/stdx/functional.h" namespace mongo { @@ -93,10 +93,10 @@ public: * fieldName : key * in : { #RAND_INT: [10, 20] } */ - typedef stdx::function<Status(BsonTemplateEvaluator* btl, - const char* fieldName, - const BSONObj& in, - BSONObjBuilder& builder)> + typedef std::function<Status(BsonTemplateEvaluator* btl, + const char* fieldName, + const BSONObj& in, + BSONObjBuilder& builder)> OperatorFn; /* diff --git a/src/mongo/scripting/dbdirectclient_factory.h b/src/mongo/scripting/dbdirectclient_factory.h index 49e71c6b7ab..eed8ec5dcf5 100644 --- a/src/mongo/scripting/dbdirectclient_factory.h +++ b/src/mongo/scripting/dbdirectclient_factory.h @@ -29,10 +29,9 @@ #pragma once +#include <functional> #include <memory> -#include "mongo/stdx/functional.h" - namespace mongo { class DBClientBase; @@ -42,7 +41,7 @@ class ServiceContext; class DBDirectClientFactory { public: using Result = std::unique_ptr<DBClientBase>; - using Impl = stdx::function<Result(OperationContext*)>; + using Impl = std::function<Result(OperationContext*)>; static DBDirectClientFactory& get(ServiceContext* service); static DBDirectClientFactory& get(OperationContext* opCtx); diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp index 78769755580..9d8cea8639f 100644 --- a/src/mongo/shell/bench.cpp +++ b/src/mongo/shell/bench.cpp @@ -1116,7 +1116,7 @@ void BenchRunOp::executeOnce(DBClientBase* conn, // Use special query function for exhaust query option. if (this->options & QueryOption_Exhaust) { BenchRunEventTrace _bret(&state->stats->queryCounter); - stdx::function<void(const BSONObj&)> castedDoNothing(doNothing); + std::function<void(const BSONObj&)> castedDoNothing(doNothing); count = conn->query(castedDoNothing, NamespaceString(this->ns), diff --git a/src/mongo/stdx/functional.h b/src/mongo/stdx/functional.h deleted file mode 100644 index 3f3a4909e38..00000000000 --- a/src/mongo/stdx/functional.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include <functional> - -namespace mongo { -namespace stdx { - -using ::std::cref; // NOLINT -using ::std::function; // NOLINT -using ::std::ref; // NOLINT - -} // namespace stdx -} // namespace mongo diff --git a/src/mongo/transport/service_entry_point_utils.cpp b/src/mongo/transport/service_entry_point_utils.cpp index 861663fae37..ab30f3c9563 100644 --- a/src/mongo/transport/service_entry_point_utils.cpp +++ b/src/mongo/transport/service_entry_point_utils.cpp @@ -33,7 +33,8 @@ #include "mongo/transport/service_entry_point_utils.h" -#include "mongo/stdx/functional.h" +#include <functional> + #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/util/assert_util.h" @@ -52,14 +53,14 @@ namespace mongo { namespace { void* runFunc(void* ctx) { - std::unique_ptr<stdx::function<void()>> taskPtr(static_cast<stdx::function<void()>*>(ctx)); + std::unique_ptr<std::function<void()>> taskPtr(static_cast<std::function<void()>*>(ctx)); (*taskPtr)(); return nullptr; } } // namespace -Status launchServiceWorkerThread(stdx::function<void()> task) { +Status launchServiceWorkerThread(std::function<void()> task) { try { #if defined(_WIN32) @@ -90,7 +91,7 @@ Status launchServiceWorkerThread(stdx::function<void()> task) { } pthread_t thread; - auto ctx = stdx::make_unique<stdx::function<void()>>(std::move(task)); + auto ctx = stdx::make_unique<std::function<void()>>(std::move(task)); int failed = pthread_create(&thread, &attrs, runFunc, ctx.get()); pthread_attr_destroy(&attrs); diff --git a/src/mongo/transport/service_entry_point_utils.h b/src/mongo/transport/service_entry_point_utils.h index a24f7667093..9f697dcf4b1 100644 --- a/src/mongo/transport/service_entry_point_utils.h +++ b/src/mongo/transport/service_entry_point_utils.h @@ -29,11 +29,12 @@ #pragma once -#include "mongo/stdx/functional.h" +#include <functional> + #include "mongo/transport/session.h" namespace mongo { -Status launchServiceWorkerThread(stdx::function<void()> task); +Status launchServiceWorkerThread(std::function<void()> task); } // namespace mongo diff --git a/src/mongo/transport/service_executor.h b/src/mongo/transport/service_executor.h index 7caf24b27fa..e48cfdd5ba2 100644 --- a/src/mongo/transport/service_executor.h +++ b/src/mongo/transport/service_executor.h @@ -29,10 +29,11 @@ #pragma once +#include <functional> + #include "mongo/base/status.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/platform/bitwise_enum_operators.h" -#include "mongo/stdx/functional.h" #include "mongo/transport/service_executor_task_names.h" #include "mongo/transport/transport_mode.h" #include "mongo/util/duration.h" @@ -49,7 +50,7 @@ namespace transport { class ServiceExecutor { public: virtual ~ServiceExecutor() = default; - using Task = stdx::function<void()>; + using Task = std::function<void()>; enum ScheduleFlags { // No flags (kEmptyFlags) specifies that this is a normal task and that the executor should // launch new threads as needed to run the task. diff --git a/src/mongo/transport/service_executor_adaptive_test.cpp b/src/mongo/transport/service_executor_adaptive_test.cpp index 62caed4e8b9..b2a7c471bbe 100644 --- a/src/mongo/transport/service_executor_adaptive_test.cpp +++ b/src/mongo/transport/service_executor_adaptive_test.cpp @@ -117,7 +117,7 @@ protected: stdx::mutex mutex; AtomicWord<int> waitFor{-1}; stdx::condition_variable cond; - stdx::function<void()> notifyCallback = [this] { + std::function<void()> notifyCallback = [this] { stdx::unique_lock<stdx::mutex> lk(mutex); invariant(waitFor.load() != -1); waitFor.fetchAndSubtract(1); @@ -267,7 +267,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, TestStarvation) { bool scheduleNew{true}; - stdx::function<void()> task; + std::function<void()> task; task = [this, &task, &exec, &scheduleMutex, &scheduleNew] { // This sleep needs to be larger than the sleep below to be able to limit the amount of @@ -313,7 +313,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, TestRecursion) { AtomicWord<int> remainingTasks{config->recursionLimit() - 1}; stdx::mutex mutex; stdx::condition_variable cv; - stdx::function<void()> task; + std::function<void()> task; auto guard = makeGuard([&] { ASSERT_OK(exec->shutdown(config->workerThreadRunTime() * 2)); }); diff --git a/src/mongo/transport/service_state_machine.cpp b/src/mongo/transport/service_state_machine.cpp index c59f31ca362..47467d871ff 100644 --- a/src/mongo/transport/service_state_machine.cpp +++ b/src/mongo/transport/service_state_machine.cpp @@ -608,7 +608,7 @@ void ServiceStateMachine::terminateIfTagsDontMatch(transport::Session::TagMask t terminate(); } -void ServiceStateMachine::setCleanupHook(stdx::function<void()> hook) { +void ServiceStateMachine::setCleanupHook(std::function<void()> hook) { invariant(state() == State::Created); _cleanupHook = std::move(hook); } diff --git a/src/mongo/transport/service_state_machine.h b/src/mongo/transport/service_state_machine.h index ea14b49b71d..59b8dbd2823 100644 --- a/src/mongo/transport/service_state_machine.h +++ b/src/mongo/transport/service_state_machine.h @@ -30,12 +30,12 @@ #pragma once #include <atomic> +#include <functional> #include "mongo/base/status.h" #include "mongo/config.h" #include "mongo/db/service_context.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" @@ -156,7 +156,7 @@ public: /* * Sets a function to be called after the session is ended */ - void setCleanupHook(stdx::function<void()> hook); + void setCleanupHook(std::function<void()> hook); private: /* @@ -232,7 +232,7 @@ private: const std::string _threadName; ServiceContext::UniqueClient _dbClient; const Client* _dbClientPtr; - stdx::function<void()> _cleanupHook; + std::function<void()> _cleanupHook; bool _inExhaust = false; boost::optional<MessageCompressorId> _compressorId; diff --git a/src/mongo/transport/service_state_machine_test.cpp b/src/mongo/transport/service_state_machine_test.cpp index 8e3427717c0..12f9120074a 100644 --- a/src/mongo/transport/service_state_machine_test.cpp +++ b/src/mongo/transport/service_state_machine_test.cpp @@ -210,7 +210,7 @@ public: return _ranSource; } - void setWaitHook(stdx::function<void()> hook) { + void setWaitHook(std::function<void()> hook) { _waitHook = std::move(hook); } @@ -225,7 +225,7 @@ private: FailureMode _nextShouldFail = Nothing; Message _lastSunk; ServiceStateMachine* _ssm; - stdx::function<void()> _waitHook; + std::function<void()> _waitHook; // A custom message for this TransportLayer to source. Message _sourceMessage; @@ -235,7 +235,7 @@ class MockServiceExecutor : public ServiceExecutor { public: explicit MockServiceExecutor(ServiceContext* ctx) {} - using ScheduleHook = stdx::function<bool(Task)>; + using ScheduleHook = std::function<bool(Task)>; Status start() override { return Status::OK(); diff --git a/src/mongo/transport/session.cpp b/src/mongo/transport/session.cpp index 0bbc4bb5eba..d3efb3051b6 100644 --- a/src/mongo/transport/session.cpp +++ b/src/mongo/transport/session.cpp @@ -54,7 +54,7 @@ void Session::unsetTags(TagMask tagsToUnset) { mutateTags([tagsToUnset](TagMask originalTags) { return (originalTags & ~tagsToUnset); }); } -void Session::mutateTags(const stdx::function<TagMask(TagMask)>& mutateFunc) { +void Session::mutateTags(const std::function<TagMask(TagMask)>& mutateFunc) { TagMask oldValue, newValue; do { oldValue = _tags.load(); diff --git a/src/mongo/transport/session.h b/src/mongo/transport/session.h index b10fe479b17..66fddd5d244 100644 --- a/src/mongo/transport/session.h +++ b/src/mongo/transport/session.h @@ -180,7 +180,7 @@ public: * of the 'mutateFunc' call. The 'kPending' tag is only for new sessions; callers should never * try to set it. */ - void mutateTags(const stdx::function<TagMask(TagMask)>& mutateFunc); + void mutateTags(const std::function<TagMask(TagMask)>& mutateFunc); TagMask getTags() const; diff --git a/src/mongo/transport/transport_layer.h b/src/mongo/transport/transport_layer.h index 6d6027e7d83..ad449dedf8b 100644 --- a/src/mongo/transport/transport_layer.h +++ b/src/mongo/transport/transport_layer.h @@ -29,11 +29,11 @@ #pragma once +#include <functional> #include <memory> #include "mongo/base/status.h" #include "mongo/db/operation_context.h" -#include "mongo/stdx/functional.h" #include "mongo/transport/session.h" #include "mongo/util/functional.h" #include "mongo/util/future.h" diff --git a/src/mongo/unittest/death_test.cpp b/src/mongo/unittest/death_test.cpp index 74b3c6fdf31..08d3fae9f17 100644 --- a/src/mongo/unittest/death_test.cpp +++ b/src/mongo/unittest/death_test.cpp @@ -61,7 +61,7 @@ namespace mongo { namespace unittest { -DeathTestImpl::DeathTestImpl(stdx::function<std::unique_ptr<Test>()> makeTest) +DeathTestImpl::DeathTestImpl(std::function<std::unique_ptr<Test>()> makeTest) : _makeTest(std::move(makeTest)) {} void DeathTestImpl::_doTest() { diff --git a/src/mongo/unittest/death_test.h b/src/mongo/unittest/death_test.h index c6bdb1a937a..df468c26ee5 100644 --- a/src/mongo/unittest/death_test.h +++ b/src/mongo/unittest/death_test.h @@ -93,12 +93,12 @@ class DeathTestImpl : public Test { DeathTestImpl& operator=(const DeathTestImpl&) = delete; protected: - explicit DeathTestImpl(stdx::function<std::unique_ptr<Test>()> makeTest); + explicit DeathTestImpl(std::function<std::unique_ptr<Test>()> makeTest); private: void _doTest() final; virtual std::string getPattern() = 0; - const stdx::function<std::unique_ptr<Test>()> _makeTest; + const std::function<std::unique_ptr<Test>()> _makeTest; }; template <typename T> diff --git a/src/mongo/unittest/unittest.cpp b/src/mongo/unittest/unittest.cpp index c36799e79fd..72ee87d30c6 100644 --- a/src/mongo/unittest/unittest.cpp +++ b/src/mongo/unittest/unittest.cpp @@ -33,6 +33,7 @@ #include "mongo/unittest/unittest.h" +#include <functional> #include <iostream> #include <map> @@ -44,7 +45,6 @@ #include "mongo/logger/logger.h" #include "mongo/logger/message_event_utf8_encoder.h" #include "mongo/logger/message_log_domain.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h index 15be3f3587a..f443857b0e3 100644 --- a/src/mongo/unittest/unittest.h +++ b/src/mongo/unittest/unittest.h @@ -37,6 +37,7 @@ #include <boost/preprocessor/cat.hpp> #include <cmath> +#include <functional> #include <sstream> #include <string> #include <type_traits> @@ -46,7 +47,6 @@ #include "mongo/base/status_with.h" #include "mongo/logger/logstream_builder.h" #include "mongo/logger/message_log_domain.h" -#include "mongo/stdx/functional.h" #include "mongo/unittest/bson_test_util.h" #include "mongo/unittest/unittest_helpers.h" #include "mongo/util/assert_util.h" @@ -330,7 +330,7 @@ mongo::logger::LogstreamBuilder warning(); /** * Type representing the function composing a test. */ -typedef stdx::function<void(void)> TestFunction; +typedef std::function<void(void)> TestFunction; /** * Container holding a test function and its name. Suites diff --git a/src/mongo/unittest/unittest_test.cpp b/src/mongo/unittest/unittest_test.cpp index cbeeb6f2322..e3325c73e1f 100644 --- a/src/mongo/unittest/unittest_test.cpp +++ b/src/mongo/unittest/unittest_test.cpp @@ -33,11 +33,11 @@ #include "mongo/platform/basic.h" +#include <functional> #include <limits> #include <string> #include "mongo/bson/bsonobjbuilder.h" -#include "mongo/stdx/functional.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp index 3627a413f1b..441cdab0e53 100644 --- a/src/mongo/util/background.cpp +++ b/src/mongo/util/background.cpp @@ -33,9 +33,10 @@ #include "mongo/util/background.h" +#include <functional> + #include "mongo/config.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/idle_thread_block.h" diff --git a/src/mongo/util/concurrency/spin_lock_test.cpp b/src/mongo/util/concurrency/spin_lock_test.cpp index 70c5288f86e..62266221b2a 100644 --- a/src/mongo/util/concurrency/spin_lock_test.cpp +++ b/src/mongo/util/concurrency/spin_lock_test.cpp @@ -29,7 +29,8 @@ #include "mongo/platform/basic.h" -#include "mongo/stdx/functional.h" +#include <functional> + #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" #include "mongo/util/concurrency/spin_lock.h" diff --git a/src/mongo/util/concurrency/thread_pool.h b/src/mongo/util/concurrency/thread_pool.h index c4873f84dff..bbae97d1ebe 100644 --- a/src/mongo/util/concurrency/thread_pool.h +++ b/src/mongo/util/concurrency/thread_pool.h @@ -30,11 +30,11 @@ #pragma once #include <deque> +#include <functional> #include <string> #include <vector> #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/thread_pool_interface.h" @@ -89,7 +89,7 @@ public: Milliseconds maxIdleThreadAge = Seconds{30}; // This function is run before each worker thread begins consuming tasks. - using OnCreateThreadFn = stdx::function<void(const std::string& threadName)>; + using OnCreateThreadFn = std::function<void(const std::string& threadName)>; OnCreateThreadFn onCreateThread = [](const std::string&) {}; }; diff --git a/src/mongo/util/concurrency/thread_pool_test_common.cpp b/src/mongo/util/concurrency/thread_pool_test_common.cpp index 2c2113bb890..2a2e1cacd3d 100644 --- a/src/mongo/util/concurrency/thread_pool_test_common.cpp +++ b/src/mongo/util/concurrency/thread_pool_test_common.cpp @@ -45,7 +45,7 @@ namespace mongo { namespace { -using ThreadPoolFactory = stdx::function<std::unique_ptr<ThreadPoolInterface>()>; +using ThreadPoolFactory = std::function<std::unique_ptr<ThreadPoolInterface>()>; class CommonThreadPoolTestFixture : public ThreadPoolTest { public: @@ -61,7 +61,7 @@ private: }; using ThreadPoolTestCaseFactory = - stdx::function<std::unique_ptr<::mongo::unittest::Test>(ThreadPoolFactory)>; + std::function<std::unique_ptr<::mongo::unittest::Test>(ThreadPoolFactory)>; using ThreadPoolTestCaseMap = stdx::unordered_map<std::string, ThreadPoolTestCaseFactory>; static ThreadPoolTestCaseMap& threadPoolTestCaseRegistry() { @@ -200,7 +200,7 @@ COMMON_THREAD_POOL_TEST(PoolJoinExecutesRemainingTasks) { COMMON_THREAD_POOL_TEST(RepeatedScheduleDoesntSmashStack) { const std::size_t depth = 10000ul; auto& pool = getThreadPool(); - stdx::function<void()> func; + std::function<void()> func; std::size_t n = 0; stdx::mutex mutex; stdx::condition_variable condvar; diff --git a/src/mongo/util/concurrency/thread_pool_test_common.h b/src/mongo/util/concurrency/thread_pool_test_common.h index f70ffc40a20..abd9cdc5025 100644 --- a/src/mongo/util/concurrency/thread_pool_test_common.h +++ b/src/mongo/util/concurrency/thread_pool_test_common.h @@ -29,11 +29,10 @@ #pragma once +#include <functional> #include <memory> #include <string> -#include "mongo/stdx/functional.h" - namespace mongo { class ThreadPoolInterface; @@ -44,6 +43,6 @@ class ThreadPoolInterface; * work against any implementation of ThreadPoolInterface. */ void addTestsForThreadPool(const std::string& suiteName, - stdx::function<std::unique_ptr<ThreadPoolInterface>()> makeThreadPool); + std::function<std::unique_ptr<ThreadPoolInterface>()> makeThreadPool); } // namespace mongo diff --git a/src/mongo/util/decoration_registry.h b/src/mongo/util/decoration_registry.h index 721d2a4077c..6e4f8ed55db 100644 --- a/src/mongo/util/decoration_registry.h +++ b/src/mongo/util/decoration_registry.h @@ -36,7 +36,6 @@ #include <vector> #include "mongo/base/static_assert.h" -#include "mongo/stdx/functional.h" #include "mongo/util/decoration_container.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/util/exit.cpp b/src/mongo/util/exit.cpp index 9f198d91d7e..b08545f8c2d 100644 --- a/src/mongo/util/exit.cpp +++ b/src/mongo/util/exit.cpp @@ -34,10 +34,10 @@ #include "mongo/util/exit.h" #include <boost/optional.hpp> +#include <functional> #include <stack> #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/log.h" diff --git a/src/mongo/util/fail_point.cpp b/src/mongo/util/fail_point.cpp index 81da6d94723..a23a680c327 100644 --- a/src/mongo/util/fail_point.cpp +++ b/src/mongo/util/fail_point.cpp @@ -125,7 +125,7 @@ void FailPoint::disableFailPoint() { } FailPoint::RetCode FailPoint::slowShouldFailOpenBlock( - stdx::function<bool(const BSONObj&)> cb) noexcept { + std::function<bool(const BSONObj&)> cb) noexcept { ValType localFpInfo = _fpInfo.addAndFetch(1); if ((localFpInfo & ACTIVE_BIT) == 0) { diff --git a/src/mongo/util/fail_point.h b/src/mongo/util/fail_point.h index 367eeab3632..f82d85785a5 100644 --- a/src/mongo/util/fail_point.h +++ b/src/mongo/util/fail_point.h @@ -29,11 +29,12 @@ #pragma once +#include <functional> + #include "mongo/base/status_with.h" #include "mongo/db/jsobj.h" #include "mongo/db/operation_context.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { @@ -196,7 +197,7 @@ private: * If a callable is passed, and returns false, this will return userIgnored and avoid altering * the mode in any way. The argument is the fail point payload. */ - RetCode slowShouldFailOpenBlock(stdx::function<bool(const BSONObj&)> cb) noexcept; + RetCode slowShouldFailOpenBlock(std::function<bool(const BSONObj&)> cb) noexcept; /** * @return the stored BSONObj in this fail point. Note that this cannot be safely diff --git a/src/mongo/util/fail_point_test.cpp b/src/mongo/util/fail_point_test.cpp index c8f974d475f..2a759a5216a 100644 --- a/src/mongo/util/fail_point_test.cpp +++ b/src/mongo/util/fail_point_test.cpp @@ -31,11 +31,11 @@ #include "mongo/platform/basic.h" +#include <functional> #include <stdexcept> #include <string> #include <vector> -#include "mongo/stdx/functional.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point.h" diff --git a/src/mongo/util/invalidating_lru_cache_test.cpp b/src/mongo/util/invalidating_lru_cache_test.cpp index 150cae38792..9546091f061 100644 --- a/src/mongo/util/invalidating_lru_cache_test.cpp +++ b/src/mongo/util/invalidating_lru_cache_test.cpp @@ -31,10 +31,10 @@ #include "mongo/platform/basic.h" -#include "boost/optional.hpp" +#include <boost/optional.hpp> +#include <functional> #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" #include "mongo/util/future.h" @@ -53,13 +53,13 @@ public: _isValid.store(isValid); } - void setValidHook(stdx::function<bool()> validHook) { + void setValidHook(std::function<bool()> validHook) { _isValidHook = std::move(validHook); } private: AtomicWord<bool> _isValid{true}; - boost::optional<stdx::function<bool()>> _isValidHook; + boost::optional<std::function<bool()>> _isValidHook; }; struct TestValueInvalidator { diff --git a/src/mongo/util/lru_cache_test.cpp b/src/mongo/util/lru_cache_test.cpp index ef24d708828..a8772bc5a93 100644 --- a/src/mongo/util/lru_cache_test.cpp +++ b/src/mongo/util/lru_cache_test.cpp @@ -141,7 +141,7 @@ void assertNotInCache(const LRUCache<K, V>& cache, const K& key) { } const std::array<int, 7> kTestSizes{1, 2, 3, 4, 5, 10, 1000}; -using SizedTest = stdx::function<void(int)>; +using SizedTest = std::function<void(int)>; void runWithDifferentSizes(SizedTest test) { for (auto size : kTestSizes) { mongo::unittest::log() << "\t\tTesting cache size of " << size; diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp index 56b5911e3f6..441fcb3e763 100644 --- a/src/mongo/util/net/ssl_manager.cpp +++ b/src/mongo/util/net/ssl_manager.cpp @@ -158,7 +158,7 @@ std::string RFC4514Parser::extractAttributeName() { StringBuilder sb; auto ch = _cur(); - stdx::function<bool(char ch)> characterCheck; + std::function<bool(char ch)> characterCheck; // If the first character is a digit, then this is an OID and can only contain // numbers and '.' if (isDigit(ch)) { diff --git a/src/mongo/util/options_parser/options_parser.cpp b/src/mongo/util/options_parser/options_parser.cpp index e888351b52c..462fccde4e2 100644 --- a/src/mongo/util/options_parser/options_parser.cpp +++ b/src/mongo/util/options_parser/options_parser.cpp @@ -76,7 +76,7 @@ namespace optionenvironment { namespace po = boost::program_options; namespace fs = boost::filesystem; -stdx::function<bool()> OptionsParser::useStrict; +std::function<bool()> OptionsParser::useStrict; namespace { diff --git a/src/mongo/util/options_parser/options_parser.h b/src/mongo/util/options_parser/options_parser.h index 0ad3d74f6a7..0dcc5db5c15 100644 --- a/src/mongo/util/options_parser/options_parser.h +++ b/src/mongo/util/options_parser/options_parser.h @@ -29,12 +29,12 @@ #pragma once +#include <functional> #include <map> #include <string> #include <vector> #include "mongo/base/status.h" -#include "mongo/stdx/functional.h" #include "mongo/util/duration.h" namespace mongo { @@ -95,7 +95,7 @@ public: * true - unknown config options will generate an error during parsing. * false - unknow config options will be ignored during parsing. */ - static stdx::function<bool()> useStrict; + static std::function<bool()> useStrict; OptionsParser() {} virtual ~OptionsParser() {} diff --git a/src/mongo/util/periodic_runner.h b/src/mongo/util/periodic_runner.h index a474fb0d6ad..1508078a87f 100644 --- a/src/mongo/util/periodic_runner.h +++ b/src/mongo/util/periodic_runner.h @@ -29,9 +29,9 @@ #pragma once +#include <functional> #include <string> -#include "mongo/stdx/functional.h" #include "mongo/util/time_support.h" namespace mongo { @@ -51,7 +51,7 @@ class Client; */ class PeriodicRunner { public: - using Job = stdx::function<void(Client* client)>; + using Job = std::function<void(Client* client)>; struct PeriodicJob { PeriodicJob(std::string name, Job callable, Milliseconds period) diff --git a/src/mongo/util/queue.h b/src/mongo/util/queue.h index 6cc79d5d47f..63321eeb926 100644 --- a/src/mongo/util/queue.h +++ b/src/mongo/util/queue.h @@ -30,12 +30,12 @@ #pragma once #include <boost/optional.hpp> +#include <functional> #include <limits> #include <queue> #include "mongo/stdx/chrono.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" namespace mongo { @@ -54,7 +54,7 @@ class BlockingQueue { BlockingQueue& operator=(const BlockingQueue&) = delete; public: - using GetSizeFn = stdx::function<size_t(const T&)>; + using GetSizeFn = std::function<size_t(const T&)>; BlockingQueue() : BlockingQueue(std::numeric_limits<std::size_t>::max()) {} BlockingQueue(size_t size) : BlockingQueue(size, [](const T&) { return 1; }) {} diff --git a/src/mongo/watchdog/watchdog.h b/src/mongo/watchdog/watchdog.h index fe0060e3534..bd29038a12a 100644 --- a/src/mongo/watchdog/watchdog.h +++ b/src/mongo/watchdog/watchdog.h @@ -30,12 +30,12 @@ #pragma once #include <boost/filesystem/path.hpp> +#include <functional> #include <string> #include <vector> #include "mongo/platform/atomic_word.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/duration.h" @@ -51,7 +51,7 @@ class OperationContext; * * It is pluggable for testing purposes. */ -using WatchdogDeathCallback = stdx::function<void(void)>; +using WatchdogDeathCallback = std::function<void(void)>; /** * The OS specific implementation of WatchdogDeathCallback that kills the process. |