summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_context.h
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2018-05-01 14:21:45 -0400
committerAndy Schwerin <schwerin@mongodb.com>2018-05-02 11:19:46 -0400
commit3e25e21a342566799516f1a23b7fcbeb49fd5d8d (patch)
tree587beaa2b5b4a1c14230bec8e751d6da2f5c06f4 /src/mongo/db/service_context.h
parentd54b9f51949186e0f99e60f41e9b2b9a7f3802c4 (diff)
downloadmongo-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.h21
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;