diff options
author | Mathias Stearn <mathias@10gen.com> | 2017-05-19 17:06:56 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2017-06-07 13:28:51 -0400 |
commit | 107327303755a830236bfef5827b543d88223b89 (patch) | |
tree | 25a9c9586fbcf1ba17651fe00abbd4a6bfebd929 /src/mongo/executor | |
parent | b89c05e65c3168cef9c813f3feca2b1a63621ca2 (diff) | |
download | mongo-107327303755a830236bfef5827b543d88223b89.tar.gz |
SERVER-29264 Kill off rpc::RequestInterface
Diffstat (limited to 'src/mongo/executor')
-rw-r--r-- | src/mongo/executor/async_mock_stream_factory.cpp | 7 | ||||
-rw-r--r-- | src/mongo/executor/network_interface_asio_test.cpp | 15 | ||||
-rw-r--r-- | src/mongo/executor/remote_command_request.h | 12 |
3 files changed, 14 insertions, 20 deletions
diff --git a/src/mongo/executor/async_mock_stream_factory.cpp b/src/mongo/executor/async_mock_stream_factory.cpp index fd87386e6e5..2951f977bcd 100644 --- a/src/mongo/executor/async_mock_stream_factory.cpp +++ b/src/mongo/executor/async_mock_stream_factory.cpp @@ -40,7 +40,6 @@ #include "mongo/rpc/command_reply_builder.h" #include "mongo/rpc/factory.h" #include "mongo/rpc/legacy_reply_builder.h" -#include "mongo/rpc/request_interface.h" #include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" @@ -283,10 +282,10 @@ void AsyncMockStreamFactory::MockStream::simulateServer( Message msg(SharedBuffer::allocate(messageData.size())); memcpy(msg.buf(), messageData.data(), messageData.size()); - auto parsedRequest = rpc::makeRequest(&msg); - ASSERT(parsedRequest->getProtocol() == proto); + auto request = rpc::opMsgRequestFromAnyProtocol(msg); + ASSERT(rpc::protocolForMessage(msg) == proto); - RemoteCommandRequest rcr(target(), *parsedRequest, nullptr); + RemoteCommandRequest rcr(target(), request.getDatabase().toString(), request.body, nullptr); messageId = msg.header().getId(); diff --git a/src/mongo/executor/network_interface_asio_test.cpp b/src/mongo/executor/network_interface_asio_test.cpp index 1f14d4063f5..0d353728df0 100644 --- a/src/mongo/executor/network_interface_asio_test.cpp +++ b/src/mongo/executor/network_interface_asio_test.cpp @@ -782,7 +782,7 @@ TEST_F(NetworkInterfaceASIOConnectionHookTest, MakeRequestReturnsNone) { // Simulate user command. stream->simulateServer(rpc::Protocol::kOpCommandV1, [&](RemoteCommandRequest request) -> RemoteCommandResponse { - ASSERT_BSONOBJ_EQ(commandRequest, request.cmdObj); + ASSERT_BSONOBJ_EQ(commandRequest, request.cmdObj.removeField("$db")); RemoteCommandResponse response; response.data = commandReply; @@ -814,6 +814,13 @@ TEST_F(NetworkInterfaceASIOConnectionHookTest, HandleReplyReturnsError) { << "blah" << "ok" << 1.0); + BSONObj hookUnifiedRequest = ([&] { + BSONObjBuilder bob; + bob.appendElements(hookCommandRequest); + bob.appendElements(hookRequestMetadata); + bob.append("$db", "foo"); + return bob.obj(); + }()); BSONObj hookReplyMetadata = BSON("1111" << 2222); Status handleReplyError{ErrorCodes::AuthSchemaIncompatible, "daowdjkpowkdjpow"}; @@ -853,8 +860,8 @@ TEST_F(NetworkInterfaceASIOConnectionHookTest, HandleReplyReturnsError) { // Simulate hook reply stream->simulateServer(rpc::Protocol::kOpCommandV1, [&](RemoteCommandRequest request) -> RemoteCommandResponse { - ASSERT_BSONOBJ_EQ(request.cmdObj, hookCommandRequest); - ASSERT_BSONOBJ_EQ(request.metadata, hookRequestMetadata); + ASSERT_BSONOBJ_EQ(request.cmdObj, hookUnifiedRequest); + ASSERT_BSONOBJ_EQ(request.metadata, BSONObj()); RemoteCommandResponse response; response.data = hookCommandReply; @@ -1027,7 +1034,7 @@ TEST_F(NetworkInterfaceASIOMetadataTest, Metadata) { // Simulate hook reply stream->simulateServer(rpc::Protocol::kOpCommandV1, [&](RemoteCommandRequest request) -> RemoteCommandResponse { - ASSERT_EQ("bar", request.metadata["foo"].str()); + ASSERT_EQ("bar", request.cmdObj["foo"].str()); RemoteCommandResponse response; response.data = BSON("ok" << 1); response.metadata = BSON("baz" diff --git a/src/mongo/executor/remote_command_request.h b/src/mongo/executor/remote_command_request.h index c6195311b69..0eb184e1d05 100644 --- a/src/mongo/executor/remote_command_request.h +++ b/src/mongo/executor/remote_command_request.h @@ -33,7 +33,6 @@ #include "mongo/db/jsobj.h" #include "mongo/rpc/metadata.h" -#include "mongo/rpc/request_interface.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" @@ -78,17 +77,6 @@ struct RemoteCommandRequest { : RemoteCommandRequest( theTarget, theDbName, theCmdObj, rpc::makeEmptyMetadata(), opCtx, timeoutMillis) {} - RemoteCommandRequest(const HostAndPort& theTarget, - const rpc::RequestInterface& request, - OperationContext* opCtx, - Milliseconds timeoutMillis = kNoTimeout) - : RemoteCommandRequest(theTarget, - request.getDatabase().toString(), - request.getCommandArgs(), - request.getMetadata(), - opCtx, - timeoutMillis) {} - std::string toString() const; bool operator==(const RemoteCommandRequest& rhs) const; |