diff options
Diffstat (limited to 'src/mongo/rpc/protocol.cpp')
-rw-r--r-- | src/mongo/rpc/protocol.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/rpc/protocol.cpp b/src/mongo/rpc/protocol.cpp index 3c3cafb6479..040cceb4dd5 100644 --- a/src/mongo/rpc/protocol.cpp +++ b/src/mongo/rpc/protocol.cpp @@ -36,7 +36,9 @@ #include "mongo/base/string_data.h" #include "mongo/bson/util/bson_extract.h" #include "mongo/db/jsobj.h" +#include "mongo/db/operation_context.h" #include "mongo/db/wire_version.h" +#include "mongo/util/decorable.h" #include "mongo/util/mongoutils/str.h" namespace mongo { @@ -54,8 +56,19 @@ const char kOpQueryOnly[] = "opQueryOnly"; const char kOpCommandOnly[] = "opCommandOnly"; const char kAll[] = "all"; +const OperationContext::Decoration<Protocol> operationProtocolDecoration = + OperationContext::declareDecoration<Protocol>(); + } // namespace +Protocol getOperationProtocol(OperationContext* txn) { + return operationProtocolDecoration(txn); +} + +void setOperationProtocol(OperationContext* txn, Protocol protocol) { + operationProtocolDecoration(txn) = protocol; +} + StatusWith<Protocol> negotiate(ProtocolSet fst, ProtocolSet snd) { using std::begin; using std::end; |