summaryrefslogtreecommitdiff
path: root/src/mongo/db/initialize_operation_session_info.h
diff options
context:
space:
mode:
authorPavithra Vetriselvan <pavithra.vetriselvan@mongodb.com>2018-02-21 14:34:30 -0500
committerPavithra Vetriselvan <pavithra.vetriselvan@mongodb.com>2018-02-21 14:37:24 -0500
commit2d23f45b457d156a5e5f97de4a811cfe44b4fb0a (patch)
tree1914dc3c8b48f1ce4963a11ee5a3ab4e2a4bf046 /src/mongo/db/initialize_operation_session_info.h
parent6883cdb23ea001e0164c69b0c8f800f5e71232c7 (diff)
downloadmongo-2d23f45b457d156a5e5f97de4a811cfe44b4fb0a.tar.gz
SERVER-32880 Parse and add autocommit parameter to Session
Diffstat (limited to 'src/mongo/db/initialize_operation_session_info.h')
-rw-r--r--src/mongo/db/initialize_operation_session_info.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mongo/db/initialize_operation_session_info.h b/src/mongo/db/initialize_operation_session_info.h
index 914284f5426..8882c4e7052 100644
--- a/src/mongo/db/initialize_operation_session_info.h
+++ b/src/mongo/db/initialize_operation_session_info.h
@@ -33,22 +33,27 @@
namespace mongo {
/**
- * Parses the session information from the body of a request and installs it on the current
- * operation context. Must only be called once per operation and should be done right in the
- * beginning.
+ * Parses the session information from the body of a request and stores the sessionId and txnNumber
+ * on the current operation context. Must only be called once per operation and should be done right
+ * in the beginning.
*
* Throws if the sessionId/txnNumber combination is not properly formatted.
*
* requiresAuth specifies if the command we're initializing operationSessionInfo for requires
* authorization or not. This can be determined by invoking ->requiresAuth() on the parsed command.
+ * If it does not require authorization, return boost::none.
*
* Both isReplSetMemberOrMongos and supportsDocLocking need to be true if the command contains a
* transaction number, otherwise this function will throw.
+ *
+ * On success, returns the parsed request information. Returning boost::none implies that the
+ * proper command or session requirements were not met.
*/
-void initializeOperationSessionInfo(OperationContext* opCtx,
- const BSONObj& requestBody,
- bool requiresAuth,
- bool isReplSetMemberOrMongos,
- bool supportsDocLocking);
+boost::optional<OperationSessionInfoFromClient> initializeOperationSessionInfo(
+ OperationContext* opCtx,
+ const BSONObj& requestBody,
+ bool requiresAuth,
+ bool isReplSetMemberOrMongos,
+ bool supportsDocLocking);
} // namespace mongo