diff options
author | Jason Carey <jcarey@argv.me> | 2019-01-23 13:18:49 -0500 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2019-02-05 22:41:49 -0500 |
commit | a23cdb1bd0f8fbe9cd79db08a24b8a89dc54ff81 (patch) | |
tree | 1adc2fdb36e6c8babaab134d53f84de3020c2404 /src/mongo/client | |
parent | 5fd66f15797c45c9bab7b59f9e55e0a2f7ad5cd0 (diff) | |
download | mongo-a23cdb1bd0f8fbe9cd79db08a24b8a89dc54ff81.tar.gz |
SERVER-39146 Refactor Baton
Refactor the baton into regular and networking batons while also
cleaning up the basic baton implementation.
Diffstat (limited to 'src/mongo/client')
-rw-r--r-- | src/mongo/client/async_client.cpp | 9 | ||||
-rw-r--r-- | src/mongo/client/async_client.h | 9 | ||||
-rw-r--r-- | src/mongo/client/remote_command_retry_scheduler_test.cpp | 2 |
3 files changed, 9 insertions, 11 deletions
diff --git a/src/mongo/client/async_client.cpp b/src/mongo/client/async_client.cpp index 520e69606bc..1a2c01ed335 100644 --- a/src/mongo/client/async_client.cpp +++ b/src/mongo/client/async_client.cpp @@ -193,7 +193,7 @@ Future<void> AsyncDBClient::initWireVersion(const std::string& appName, }); } -Future<Message> AsyncDBClient::_call(Message request, const transport::BatonHandle& baton) { +Future<Message> AsyncDBClient::_call(Message request, const BatonHandle& baton) { auto swm = _compressorManager.compressMessage(request); if (!swm.isOK()) { return swm.getStatus(); @@ -219,8 +219,7 @@ Future<Message> AsyncDBClient::_call(Message request, const transport::BatonHand }); } -Future<rpc::UniqueReply> AsyncDBClient::runCommand(OpMsgRequest request, - const transport::BatonHandle& baton) { +Future<rpc::UniqueReply> AsyncDBClient::runCommand(OpMsgRequest request, const BatonHandle& baton) { invariant(_negotiatedProtocol); auto requestMsg = rpc::messageFromOpMsgRequest(*_negotiatedProtocol, std::move(request)); return _call(std::move(requestMsg), baton) @@ -230,7 +229,7 @@ Future<rpc::UniqueReply> AsyncDBClient::runCommand(OpMsgRequest request, } Future<executor::RemoteCommandResponse> AsyncDBClient::runCommandRequest( - executor::RemoteCommandRequest request, const transport::BatonHandle& baton) { + executor::RemoteCommandRequest request, const BatonHandle& baton) { auto clkSource = _svcCtx->getPreciseClockSource(); auto start = clkSource->now(); auto opMsgRequest = OpMsgRequest::fromDBAndBody( @@ -246,7 +245,7 @@ Future<executor::RemoteCommandResponse> AsyncDBClient::runCommandRequest( }); } -void AsyncDBClient::cancel(const transport::BatonHandle& baton) { +void AsyncDBClient::cancel(const BatonHandle& baton) { _session->cancelAsyncOperations(baton); } diff --git a/src/mongo/client/async_client.h b/src/mongo/client/async_client.h index 356f4e0f0ca..e7a40dcc73f 100644 --- a/src/mongo/client/async_client.h +++ b/src/mongo/client/async_client.h @@ -62,9 +62,8 @@ public: Milliseconds timeout); Future<executor::RemoteCommandResponse> runCommandRequest( - executor::RemoteCommandRequest request, const transport::BatonHandle& baton = nullptr); - Future<rpc::UniqueReply> runCommand(OpMsgRequest request, - const transport::BatonHandle& baton = nullptr); + executor::RemoteCommandRequest request, const BatonHandle& baton = nullptr); + Future<rpc::UniqueReply> runCommand(OpMsgRequest request, const BatonHandle& baton = nullptr); Future<void> authenticate(const BSONObj& params); @@ -73,7 +72,7 @@ public: Future<void> initWireVersion(const std::string& appName, executor::NetworkConnectionHook* const hook); - void cancel(const transport::BatonHandle& baton = nullptr); + void cancel(const BatonHandle& baton = nullptr); bool isStillConnected(); @@ -83,7 +82,7 @@ public: const HostAndPort& local() const; private: - Future<Message> _call(Message request, const transport::BatonHandle& baton = nullptr); + Future<Message> _call(Message request, const BatonHandle& baton = nullptr); BSONObj _buildIsMasterRequest(const std::string& appName, executor::NetworkConnectionHook* hook); void _parseIsMasterResponse(BSONObj request, diff --git a/src/mongo/client/remote_command_retry_scheduler_test.cpp b/src/mongo/client/remote_command_retry_scheduler_test.cpp index 503a7c4a42e..81ecd179dcc 100644 --- a/src/mongo/client/remote_command_retry_scheduler_test.cpp +++ b/src/mongo/client/remote_command_retry_scheduler_test.cpp @@ -94,7 +94,7 @@ public: virtual StatusWith<executor::TaskExecutor::CallbackHandle> scheduleRemoteCommand( const executor::RemoteCommandRequest& request, const RemoteCommandCallbackFn& cb, - const transport::BatonHandle& baton = nullptr) override { + const BatonHandle& baton = nullptr) override { if (scheduleRemoteCommandFailPoint) { return Status(ErrorCodes::ShutdownInProgress, "failed to send remote command - shutdown in progress"); |