diff options
author | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2019-06-04 13:49:06 -0400 |
---|---|---|
committer | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2019-06-07 19:29:41 -0400 |
commit | ac88c6d4c085e72b6f0ae364b8d11dc604627efb (patch) | |
tree | 1ab2353fe282238f1bea53fb622052dbcec5567c /src/mongo/db/catalog/collection.cpp | |
parent | 61659a724e284e39a24cedc771b36c645192f398 (diff) | |
download | mongo-ac88c6d4c085e72b6f0ae364b8d11dc604627efb.tar.gz |
SERVER-40716 Refactor catalog initialization logic on startup
Diffstat (limited to 'src/mongo/db/catalog/collection.cpp')
-rw-r--r-- | src/mongo/db/catalog/collection.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp index dbd94df7d7e..685632a2f8d 100644 --- a/src/mongo/db/catalog/collection.cpp +++ b/src/mongo/db/catalog/collection.cpp @@ -73,6 +73,24 @@ bool CappedInsertNotifier::isDead() { // ---- +namespace { +const auto getFactory = ServiceContext::declareDecoration<std::unique_ptr<Collection::Factory>>(); +} + +Collection::Factory* Collection::Factory::get(ServiceContext* service) { + return getFactory(service).get(); +} + +Collection::Factory* Collection::Factory::get(OperationContext* opCtx) { + return getFactory(opCtx->getServiceContext()).get(); +}; + +void Collection::Factory::set(ServiceContext* service, + std::unique_ptr<Collection::Factory> newFactory) { + auto& factory = getFactory(service); + factory = std::move(newFactory); +} + // static Status Collection::parseValidationLevel(StringData newLevel) { if (newLevel == "") { |