diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-06-10 01:18:23 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-06-10 01:18:23 -0400 |
commit | c9548e729c8fecd9d7a9a5dd341da0433194ac73 (patch) | |
tree | 37b05114182d8a7787c0b39aa71b0ec381292e85 /src/mongo/db | |
parent | c43636652fc4fb69a47f4eaaa767bc57bb59bb5f (diff) | |
download | mongo-c9548e729c8fecd9d7a9a5dd341da0433194ac73.tar.gz |
SERVER-39338 Remove `stdx/functional.h`
Diffstat (limited to 'src/mongo/db')
162 files changed, 376 insertions, 353 deletions
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(); |