diff options
Diffstat (limited to 'src/mongo/shell/encrypted_dbclient_base.h')
| -rw-r--r-- | src/mongo/shell/encrypted_dbclient_base.h | 60 |
1 files changed, 8 insertions, 52 deletions
diff --git a/src/mongo/shell/encrypted_dbclient_base.h b/src/mongo/shell/encrypted_dbclient_base.h index f7a7608f70a..4c0a75434fb 100644 --- a/src/mongo/shell/encrypted_dbclient_base.h +++ b/src/mongo/shell/encrypted_dbclient_base.h @@ -102,11 +102,7 @@ public: using DBClientBase::runCommandWithTarget; virtual std::pair<rpc::UniqueReply, DBClientBase*> runCommandWithTarget( - OpMsgRequest request) final; - - std::pair<rpc::UniqueReply, std::shared_ptr<DBClientBase>> runCommandWithTarget( - OpMsgRequest request, std::shared_ptr<DBClientBase>) final; - + OpMsgRequest request) override; std::string toString() const final; int getMinWireVersion() final; @@ -157,8 +153,6 @@ public: bool isMongos() const final; - DBClientBase* getRawConnection(); - #ifdef MONGO_CONFIG_SSL const SSLConfiguration* getSSLConfiguration() override; @@ -170,54 +164,16 @@ public: protected: BSONObj _decryptResponsePayload(BSONObj& reply, StringData databaseName, bool isFLE2); - enum class RunCommandConnectionType { rawPtr, sharedPtr }; - - struct RunCommandParams { - OpMsgRequest request; - std::shared_ptr<DBClientBase> conn; - RunCommandConnectionType type; - - RunCommandParams(OpMsgRequest request) - : request(std::move(request)), type(RunCommandConnectionType::rawPtr){}; - - RunCommandParams(OpMsgRequest request, std::shared_ptr<DBClientBase> base) - : request(std::move(request)), conn(base), type(RunCommandConnectionType::sharedPtr){}; - - RunCommandParams(OpMsgRequest request, RunCommandParams params) - : request(std::move(request)), type(params.type) { - if (type == RunCommandConnectionType::sharedPtr) { - conn = params.conn; - }; - }; - }; - - using RunCommandReturnConn = stdx::variant<DBClientBase*, std::shared_ptr<DBClientBase>>; - - struct RunCommandReturn { - rpc::UniqueReply returnReply; - RunCommandReturnConn returnConn; - - RunCommandReturn(std::pair<rpc::UniqueReply, DBClientBase*> pair) - : returnReply(std::move(std::get<0>(pair))), returnConn(std::get<1>(pair)) {} - - RunCommandReturn(std::pair<rpc::UniqueReply, std::shared_ptr<DBClientBase>> pair) - : returnReply(std::move(std::get<0>(pair))), returnConn(std::get<1>(pair)) {} - - RunCommandReturn(rpc::UniqueReply reply, RunCommandReturn& result) - : returnReply(std::move(reply)), returnConn(result.returnConn) {} - }; - - RunCommandReturn doRunCommand(RunCommandParams params); - - virtual RunCommandReturn handleEncryptionRequest(RunCommandParams params); + std::pair<rpc::UniqueReply, DBClientBase*> processResponseFLE1(rpc::UniqueReply result, + StringData databaseName); - RunCommandReturn processResponseFLE1(RunCommandReturn result, StringData databaseName); + std::pair<rpc::UniqueReply, DBClientBase*> processResponseFLE2(rpc::UniqueReply result, + StringData databaseName); - RunCommandReturn processResponseFLE2(RunCommandReturn result, StringData DatabaseName); + std::pair<rpc::UniqueReply, DBClientBase*> prepareReply(rpc::UniqueReply result, + StringData databaseName, + BSONObj decryptedDoc); - RunCommandReturn prepareReply(RunCommandReturn result, - StringData databaseName, - BSONObj decryptedDoc); BSONObj encryptDecryptCommand(const BSONObj& object, bool encrypt, StringData databaseName); |
