summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2019-06-10 01:18:23 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-06-10 01:18:23 -0400
commitc9548e729c8fecd9d7a9a5dd341da0433194ac73 (patch)
tree37b05114182d8a7787c0b39aa71b0ec381292e85 /src/mongo/client
parentc43636652fc4fb69a47f4eaaa767bc57bb59bb5f (diff)
downloadmongo-c9548e729c8fecd9d7a9a5dd341da0433194ac73.tar.gz
SERVER-39338 Remove `stdx/functional.h`
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/authenticate.h6
-rw-r--r--src/mongo/client/dbclient_base.cpp8
-rw-r--r--src/mongo/client/dbclient_base.h14
-rw-r--r--src/mongo/client/dbclient_connection.cpp4
-rw-r--r--src/mongo/client/dbclient_connection.h6
-rw-r--r--src/mongo/client/fetcher.h4
-rw-r--r--src/mongo/client/remote_command_retry_scheduler_test.cpp18
-rw-r--r--src/mongo/client/replica_set_monitor.cpp2
-rw-r--r--src/mongo/client/replica_set_monitor.h3
-rw-r--r--src/mongo/client/sasl_client_session.h4
10 files changed, 34 insertions, 35 deletions
diff --git a/src/mongo/client/authenticate.h b/src/mongo/client/authenticate.h
index e5825e52111..15c9cd0b9b4 100644
--- a/src/mongo/client/authenticate.h
+++ b/src/mongo/client/authenticate.h
@@ -29,6 +29,7 @@
#pragma once
+#include <functional>
#include <string>
#include "mongo/base/status_with.h"
@@ -37,7 +38,6 @@
#include "mongo/db/auth/user_name.h"
#include "mongo/executor/remote_command_response.h"
#include "mongo/rpc/op_msg.h"
-#include "mongo/stdx/functional.h"
#include "mongo/util/future.h"
#include "mongo/util/md5.h"
#include "mongo/util/net/hostandport.h"
@@ -48,10 +48,10 @@ class BSONObj;
namespace auth {
-using RunCommandHook = stdx::function<Future<BSONObj>(OpMsgRequest request)>;
+using RunCommandHook = std::function<Future<BSONObj>(OpMsgRequest request)>;
/* Hook for legacy MONGODB-CR support provided by shell client only */
-using AuthMongoCRHandler = stdx::function<Future<void>(RunCommandHook, const BSONObj&)>;
+using AuthMongoCRHandler = std::function<Future<void>(RunCommandHook, const BSONObj&)>;
extern AuthMongoCRHandler authMongoCR;
/**
diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp
index befee2a0350..dcf30fa1881 100644
--- a/src/mongo/client/dbclient_base.cpp
+++ b/src/mongo/client/dbclient_base.cpp
@@ -710,10 +710,10 @@ struct DBClientFunConvertor {
_f(i.nextSafe());
}
}
- stdx::function<void(const BSONObj&)> _f;
+ std::function<void(const BSONObj&)> _f;
};
-unsigned long long DBClientBase::query(stdx::function<void(const BSONObj&)> f,
+unsigned long long DBClientBase::query(std::function<void(const BSONObj&)> f,
const NamespaceStringOrUUID& nsOrUuid,
Query query,
const BSONObj* fieldsToReturn,
@@ -721,11 +721,11 @@ unsigned long long DBClientBase::query(stdx::function<void(const BSONObj&)> f,
int batchSize) {
DBClientFunConvertor fun;
fun._f = f;
- stdx::function<void(DBClientCursorBatchIterator&)> ptr(fun);
+ std::function<void(DBClientCursorBatchIterator&)> ptr(fun);
return this->query(ptr, nsOrUuid, query, fieldsToReturn, queryOptions, batchSize);
}
-unsigned long long DBClientBase::query(stdx::function<void(DBClientCursorBatchIterator&)> f,
+unsigned long long DBClientBase::query(std::function<void(DBClientCursorBatchIterator&)> f,
const NamespaceStringOrUUID& nsOrUuid,
Query query,
const BSONObj* fieldsToReturn,
diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h
index ea8914e3fed..558cc3efa8e 100644
--- a/src/mongo/client/dbclient_base.h
+++ b/src/mongo/client/dbclient_base.h
@@ -30,6 +30,7 @@
#pragma once
#include <cstdint>
+#include <functional>
#include "mongo/base/string_data.h"
#include "mongo/client/authenticate.h"
@@ -49,7 +50,6 @@
#include "mongo/rpc/op_msg.h"
#include "mongo/rpc/protocol.h"
#include "mongo/rpc/unique_message.h"
-#include "mongo/stdx/functional.h"
#include "mongo/transport/message_compressor_manager.h"
#include "mongo/transport/session.h"
#include "mongo/transport/transport_layer.h"
@@ -81,14 +81,14 @@ class DBClientQueryInterface {
int queryOptions = 0,
int batchSize = 0) = 0;
- virtual unsigned long long query(stdx::function<void(const BSONObj&)> f,
+ virtual unsigned long long query(std::function<void(const BSONObj&)> f,
const NamespaceStringOrUUID& nsOrUuid,
Query query,
const BSONObj* fieldsToReturn = 0,
int queryOptions = 0,
int batchSize = 0) = 0;
- virtual unsigned long long query(stdx::function<void(DBClientCursorBatchIterator&)> f,
+ virtual unsigned long long query(std::function<void(DBClientCursorBatchIterator&)> f,
const NamespaceStringOrUUID& nsOrUuid,
Query query,
const BSONObj* fieldsToReturn = 0,
@@ -200,7 +200,7 @@ public:
/**
* Gets the RequestMetadataWriter that is set on this connection. This may
- * be an uninitialized stdx::function, so it should be checked for validity
+ * be an uninitialized std::function, so it should be checked for validity
* with operator bool() first.
*/
const rpc::RequestMetadataWriter& getRequestMetadataWriter();
@@ -214,7 +214,7 @@ public:
/**
* Gets the ReplyMetadataReader that is set on this connection. This may
- * be an uninitialized stdx::function, so it should be checked for validity
+ * be an uninitialized std::function, so it should be checked for validity
* with operator bool() first.
*/
const rpc::ReplyMetadataReader& getReplyMetadataReader();
@@ -602,14 +602,14 @@ public:
The version that takes a BSONObj cannot return the namespace queried when the query is
is done by UUID. If this is required, use the DBClientBatchIterator version.
*/
- unsigned long long query(stdx::function<void(const BSONObj&)> f,
+ unsigned long long query(std::function<void(const BSONObj&)> f,
const NamespaceStringOrUUID& nsOrUuid,
Query query,
const BSONObj* fieldsToReturn = 0,
int queryOptions = QueryOption_Exhaust,
int batchSize = 0) final;
- unsigned long long query(stdx::function<void(DBClientCursorBatchIterator&)> f,
+ unsigned long long query(std::function<void(DBClientCursorBatchIterator&)> f,
const NamespaceStringOrUUID& nsOrUuid,
Query query,
const BSONObj* fieldsToReturn = 0,
diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp
index 938c1167fbc..c812cea4a11 100644
--- a/src/mongo/client/dbclient_connection.cpp
+++ b/src/mongo/client/dbclient_connection.cpp
@@ -38,6 +38,7 @@
#include "mongo/client/dbclient_connection.h"
#include <algorithm>
+#include <functional>
#include <utility>
#include "mongo/base/status.h"
@@ -63,7 +64,6 @@
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/metadata/client_metadata.h"
#include "mongo/s/stale_exception.h"
-#include "mongo/stdx/functional.h"
#include "mongo/stdx/memory.h"
#include "mongo/stdx/mutex.h"
#include "mongo/util/assert_util.h"
@@ -520,7 +520,7 @@ uint64_t DBClientConnection::getSockCreationMicroSec() const {
}
}
-unsigned long long DBClientConnection::query(stdx::function<void(DBClientCursorBatchIterator&)> f,
+unsigned long long DBClientConnection::query(std::function<void(DBClientCursorBatchIterator&)> f,
const NamespaceStringOrUUID& nsOrUuid,
Query query,
const BSONObj* fieldsToReturn,
diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h
index 13788423545..dc2f9ae7f6c 100644
--- a/src/mongo/client/dbclient_connection.h
+++ b/src/mongo/client/dbclient_connection.h
@@ -30,6 +30,7 @@
#pragma once
#include <cstdint>
+#include <functional>
#include "mongo/base/string_data.h"
#include "mongo/client/connection_string.h"
@@ -48,7 +49,6 @@
#include "mongo/rpc/op_msg.h"
#include "mongo/rpc/protocol.h"
#include "mongo/rpc/unique_message.h"
-#include "mongo/stdx/functional.h"
#include "mongo/stdx/mutex.h"
#include "mongo/transport/message_compressor_manager.h"
#include "mongo/transport/session.h"
@@ -83,7 +83,7 @@ public:
* status.
*/
using HandshakeValidationHook =
- stdx::function<Status(const executor::RemoteCommandResponse& isMasterReply)>;
+ std::function<Status(const executor::RemoteCommandResponse& isMasterReply)>;
/**
@param _autoReconnect if true, automatically reconnect on a connection failure
@@ -162,7 +162,7 @@ public:
nsOrUuid, query, nToReturn, nToSkip, fieldsToReturn, queryOptions, batchSize);
}
- unsigned long long query(stdx::function<void(DBClientCursorBatchIterator&)> f,
+ unsigned long long query(std::function<void(DBClientCursorBatchIterator&)> f,
const NamespaceStringOrUUID& nsOrUuid,
Query query,
const BSONObj* fieldsToReturn,
diff --git a/src/mongo/client/fetcher.h b/src/mongo/client/fetcher.h
index 3f877a0c9ec..78bbdc378b8 100644
--- a/src/mongo/client/fetcher.h
+++ b/src/mongo/client/fetcher.h
@@ -29,6 +29,7 @@
#pragma once
+#include <functional>
#include <iosfwd>
#include <memory>
#include <string>
@@ -42,7 +43,6 @@
#include "mongo/db/namespace_string.h"
#include "mongo/executor/task_executor.h"
#include "mongo/stdx/condition_variable.h"
-#include "mongo/stdx/functional.h"
#include "mongo/stdx/mutex.h"
#include "mongo/util/net/hostandport.h"
@@ -84,7 +84,7 @@ public:
/**
* Type of a fetcher callback function.
*/
- typedef stdx::function<void(const StatusWith<QueryResponse>&, NextAction*, BSONObjBuilder*)>
+ typedef std::function<void(const StatusWith<QueryResponse>&, NextAction*, BSONObjBuilder*)>
CallbackFn;
/**
diff --git a/src/mongo/client/remote_command_retry_scheduler_test.cpp b/src/mongo/client/remote_command_retry_scheduler_test.cpp
index 4ef9699d225..b8536d0fa48 100644
--- a/src/mongo/client/remote_command_retry_scheduler_test.cpp
+++ b/src/mongo/client/remote_command_retry_scheduler_test.cpp
@@ -321,7 +321,7 @@ TEST_F(RemoteCommandRetrySchedulerTest,
auto policy = RemoteCommandRetryScheduler::makeRetryPolicy(
10U, Milliseconds(1), {ErrorCodes::HostUnreachable});
RemoteCommandRetryScheduler scheduler(
- &getExecutor(), request, stdx::ref(callback), std::move(policy));
+ &getExecutor(), request, std::ref(callback), std::move(policy));
start(&scheduler);
auto net = getNet();
@@ -343,7 +343,7 @@ TEST_F(RemoteCommandRetrySchedulerTest,
auto policy = RemoteCommandRetryScheduler::makeRetryPolicy(
10U, Milliseconds(1), {ErrorCodes::HostUnreachable});
RemoteCommandRetryScheduler scheduler(
- &getExecutor(), request, stdx::ref(callback), std::move(policy));
+ &getExecutor(), request, std::ref(callback), std::move(policy));
start(&scheduler);
scheduler.shutdown();
@@ -358,7 +358,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, SchedulerInvokesCallbackOnNonRetryableEr
auto policy = RemoteCommandRetryScheduler::makeRetryPolicy(
10U, Milliseconds(1), RemoteCommandRetryScheduler::kNotMasterErrors);
RemoteCommandRetryScheduler scheduler(
- &getExecutor(), request, stdx::ref(callback), std::move(policy));
+ &getExecutor(), request, std::ref(callback), std::move(policy));
start(&scheduler);
// This should match one of the non-retryable error codes in the policy.
@@ -375,7 +375,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, SchedulerInvokesCallbackOnFirstSuccessfu
auto policy = RemoteCommandRetryScheduler::makeRetryPolicy(
10U, Milliseconds(1), {ErrorCodes::HostUnreachable});
RemoteCommandRetryScheduler scheduler(
- &getExecutor(), request, stdx::ref(callback), std::move(policy));
+ &getExecutor(), request, std::ref(callback), std::move(policy));
start(&scheduler);
// Elapsed time in response is ignored on successful responses.
@@ -394,7 +394,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, SchedulerIgnoresEmbeddedErrorInSuccessfu
auto policy = RemoteCommandRetryScheduler::makeRetryPolicy(
10U, Milliseconds(1), {ErrorCodes::HostUnreachable});
RemoteCommandRetryScheduler scheduler(
- &getExecutor(), request, stdx::ref(callback), std::move(policy));
+ &getExecutor(), request, std::ref(callback), std::move(policy));
start(&scheduler);
// Scheduler does not parse document in a successful response for embedded errors.
@@ -417,7 +417,7 @@ TEST_F(RemoteCommandRetrySchedulerTest,
3U, executor::RemoteCommandRequest::kNoTimeout, {ErrorCodes::HostNotFound});
TaskExecutorWithFailureInScheduleRemoteCommand badExecutor(&getExecutor());
RemoteCommandRetryScheduler scheduler(
- &badExecutor, request, stdx::ref(callback), std::move(policy));
+ &badExecutor, request, std::ref(callback), std::move(policy));
start(&scheduler);
processNetworkResponse({ErrorCodes::HostNotFound, "first", Milliseconds(0)});
@@ -439,7 +439,7 @@ TEST_F(RemoteCommandRetrySchedulerTest,
executor::RemoteCommandRequest::kNoTimeout,
RemoteCommandRetryScheduler::kAllRetriableErrors);
RemoteCommandRetryScheduler scheduler(
- &getExecutor(), request, stdx::ref(callback), std::move(policy));
+ &getExecutor(), request, std::ref(callback), std::move(policy));
start(&scheduler);
processNetworkResponse({ErrorCodes::HostNotFound, "first", Milliseconds(0)});
@@ -455,7 +455,7 @@ TEST_F(RemoteCommandRetrySchedulerTest, SchedulerShouldRetryUntilSuccessfulRespo
auto policy = RemoteCommandRetryScheduler::makeRetryPolicy(
3U, executor::RemoteCommandRequest::kNoTimeout, {ErrorCodes::HostNotFound});
RemoteCommandRetryScheduler scheduler(
- &getExecutor(), request, stdx::ref(callback), std::move(policy));
+ &getExecutor(), request, std::ref(callback), std::move(policy));
start(&scheduler);
processNetworkResponse({ErrorCodes::HostNotFound, "first", Milliseconds(0)});
@@ -502,7 +502,7 @@ TEST_F(RemoteCommandRetrySchedulerTest,
auto policyPtr = policy.get();
TaskExecutorWithFailureInScheduleRemoteCommand badExecutor(&getExecutor());
RemoteCommandRetryScheduler scheduler(
- &badExecutor, request, stdx::ref(callback), std::move(policy));
+ &badExecutor, request, std::ref(callback), std::move(policy));
policyPtr->scheduler = &scheduler;
start(&scheduler);
diff --git a/src/mongo/client/replica_set_monitor.cpp b/src/mongo/client/replica_set_monitor.cpp
index 113673ad1b5..cca254b4007 100644
--- a/src/mongo/client/replica_set_monitor.cpp
+++ b/src/mongo/client/replica_set_monitor.cpp
@@ -1075,7 +1075,7 @@ std::vector<HostAndPort> SetState::getMatchingHosts(const ReadPreferenceSetting&
// The difference between these is handled by Node::matches
case ReadPreference::SecondaryOnly:
case ReadPreference::Nearest: {
- stdx::function<bool(const Node&)> matchNode = [](const Node& node) -> bool {
+ std::function<bool(const Node&)> matchNode = [](const Node& node) -> bool {
return true;
};
// build comparator
diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h
index f572c826600..ec59ce58eb3 100644
--- a/src/mongo/client/replica_set_monitor.h
+++ b/src/mongo/client/replica_set_monitor.h
@@ -30,7 +30,7 @@
#pragma once
#include <atomic>
-#include <memory>
+#include <functional>
#include <memory>
#include <set>
#include <string>
@@ -40,7 +40,6 @@
#include "mongo/client/replica_set_change_notifier.h"
#include "mongo/executor/task_executor.h"
#include "mongo/platform/atomic_word.h"
-#include "mongo/stdx/functional.h"
#include "mongo/util/concurrency/with_lock.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/time_support.h"
diff --git a/src/mongo/client/sasl_client_session.h b/src/mongo/client/sasl_client_session.h
index dcb0df60e62..ae384359e20 100644
--- a/src/mongo/client/sasl_client_session.h
+++ b/src/mongo/client/sasl_client_session.h
@@ -29,12 +29,12 @@
#pragma once
+#include <functional>
#include <memory>
#include <string>
#include "mongo/base/status.h"
#include "mongo/base/string_data.h"
-#include "mongo/stdx/functional.h"
namespace mongo {
@@ -56,7 +56,7 @@ class SaslClientSession {
SaslClientSession& operator=(const SaslClientSession&) = delete;
public:
- typedef stdx::function<SaslClientSession*(const std::string&)> SaslClientSessionFactoryFn;
+ typedef std::function<SaslClientSession*(const std::string&)> SaslClientSessionFactoryFn;
static SaslClientSessionFactoryFn create;
/**