summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.h
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2017-04-05 16:48:16 -0400
committersamantharitter <samantha.ritter@10gen.com>2017-04-12 13:17:21 -0400
commit7dc10fd9d845756bb983fe1637dece6f3d37b981 (patch)
treefdb3d1042f0cfa4c5f1eb5b5994615021d174f99 /src/mongo/db/operation_context.h
parent56b8f03ca7c0c6a315a30a7a41bd781540dedde8 (diff)
downloadmongo-7dc10fd9d845756bb983fe1637dece6f3d37b981.tar.gz
SERVER-28298 Allow OperationContext objects to be created with an optional LogicalSessionId
Diffstat (limited to 'src/mongo/db/operation_context.h')
-rw-r--r--src/mongo/db/operation_context.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h
index 54be41d5e29..b60bf3d863b 100644
--- a/src/mongo/db/operation_context.h
+++ b/src/mongo/db/operation_context.h
@@ -28,12 +28,14 @@
#pragma once
+#include <boost/optional.hpp>
#include <memory>
#include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/locker.h"
+#include "mongo/db/logical_session_id.h"
#include "mongo/db/storage/recovery_unit.h"
#include "mongo/db/storage/recovery_unit.h"
#include "mongo/db/storage/storage_options.h"
@@ -268,6 +270,13 @@ public:
}
/**
+ * Returns the session ID associated with this operation, if there is one.
+ */
+ boost::optional<LogicalSessionId> getLogicalSessionId() const {
+ return _lsid;
+ }
+
+ /**
* Returns WriteConcernOptions of the current operation
*/
const WriteConcernOptions& getWriteConcern() const {
@@ -379,7 +388,7 @@ public:
Microseconds getRemainingMaxTimeMicros() const;
protected:
- OperationContext(Client* client, unsigned int opId);
+ OperationContext(Client* client, unsigned int opId, boost::optional<LogicalSessionId> lsid);
private:
/**
@@ -411,6 +420,7 @@ private:
friend class repl::UnreplicatedWritesBlock;
Client* const _client;
const unsigned int _opId;
+ boost::optional<LogicalSessionId> _lsid;
std::unique_ptr<Locker> _locker;