summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/collection.cpp
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2019-06-04 13:49:06 -0400
committerXiangyu Yao <xiangyu.yao@mongodb.com>2019-06-07 19:29:41 -0400
commitac88c6d4c085e72b6f0ae364b8d11dc604627efb (patch)
tree1ab2353fe282238f1bea53fb622052dbcec5567c /src/mongo/db/catalog/collection.cpp
parent61659a724e284e39a24cedc771b36c645192f398 (diff)
downloadmongo-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.cpp18
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 == "") {