From e1cae24805e3e7282958ee67a01555dd6ce40039 Mon Sep 17 00:00:00 2001 From: samantharitter Date: Tue, 27 Jun 2017 12:09:40 -0400 Subject: SERVER-29610 Allow LogicalSessionIds to contain signed user information --- src/mongo/db/service_context.h | 48 ++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'src/mongo/db/service_context.h') diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h index 3cf830c3fe7..9f97445d69f 100644 --- a/src/mongo/db/service_context.h +++ b/src/mongo/db/service_context.h @@ -31,7 +31,8 @@ #include #include "mongo/base/disallow_copying.h" -#include "mongo/db/logical_session_cache.h" +#include "mongo/db/keys_collection_manager.h" +#include "mongo/db/logical_session_id.h" #include "mongo/db/storage/storage_engine.h" #include "mongo/platform/atomic_word.h" #include "mongo/platform/unordered_set.h" @@ -265,6 +266,28 @@ public: */ virtual StorageEngine* getGlobalStorageEngine() = 0; + // + // Key manager, for HMAC keys. + // + + /** + * Sets the key manager on this service context. + */ + void setKeyManager(std::shared_ptr keyManager) & { + stdx::lock_guard lk(_mutex); + _keyManager = std::move(keyManager); + } + + /** + * Returns a pointer to the keys collection manager owned by this service context. + */ + std::shared_ptr getKeyManager() & { + stdx::lock_guard lk(_mutex); + return _keyManager; + } + + std::shared_ptr getKeyManager() && = delete; + // // Global operation management. This may not belong here and there may be too many methods // here. @@ -328,21 +351,6 @@ public: */ PeriodicRunner* getPeriodicRunner() const; - // - // Logical sessions. - // - - /** - * Set the logical session cache on this service context. - */ - void setLogicalSessionCache(std::unique_ptr cache) &; - - /** - * Return a pointer to the logical session cache on this service context. - */ - LogicalSessionCache* getLogicalSessionCache() const&; - LogicalSessionCache* getLogicalSessionCache() && = delete; - // // Transport. // @@ -459,14 +467,14 @@ private: void _killOperation_inlock(OperationContext* opCtx, ErrorCodes::Error killCode); /** - * The periodic runner. + * The key manager. */ - std::unique_ptr _runner; + std::shared_ptr _keyManager; /** - * The logical session cache. + * The periodic runner. */ - std::unique_ptr _sessionCache; + std::unique_ptr _runner; /** * The TransportLayer. -- cgit v1.2.1