diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2018-05-01 14:21:45 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2018-05-02 11:19:46 -0400 |
commit | 3e25e21a342566799516f1a23b7fcbeb49fd5d8d (patch) | |
tree | 587beaa2b5b4a1c14230bec8e751d6da2f5c06f4 /src/mongo/db/service_context.h | |
parent | d54b9f51949186e0f99e60f41e9b2b9a7f3802c4 (diff) | |
download | mongo-3e25e21a342566799516f1a23b7fcbeb49fd5d8d.tar.gz |
SERVER-34751 Move StorageEngine ownership to ServiceContext from subclasses
Diffstat (limited to 'src/mongo/db/service_context.h')
-rw-r--r-- | src/mongo/db/service_context.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h index 7ef549cac20..305a85c226f 100644 --- a/src/mongo/db/service_context.h +++ b/src/mongo/db/service_context.h @@ -267,9 +267,23 @@ public: virtual void shutdownGlobalStorageEngineCleanly() = 0; /** + * Sets the storage engine for this instance. May be called up to once per instance. + */ + void setStorageEngine(std::unique_ptr<StorageEngine> engine); + + /** + * Return the storage engine instance we're using. + */ + StorageEngine* getStorageEngine() { + return _storageEngine.get(); + } + + /** * Return the storage engine instance we're using. */ - virtual StorageEngine* getGlobalStorageEngine() = 0; + StorageEngine* getGlobalStorageEngine() { + return getStorageEngine(); + } // // Global operation management. This may not belong here and there may be too many methods @@ -461,6 +475,11 @@ private: virtual std::unique_ptr<OperationContext> _newOpCtx(Client* client, unsigned opId) = 0; /** + * The storage engine, if any. + */ + std::unique_ptr<StorageEngine> _storageEngine; + + /** * The periodic runner. */ std::unique_ptr<PeriodicRunner> _runner; |