summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_context.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2018-05-05 10:20:46 -0400
committerAndy Schwerin <schwerin@mongodb.com>2018-05-05 10:20:46 -0400
commit30994f3bacb6e814ae015d83693c549a3b924ccc (patch)
treebb959682199469dc6039406721a2f8000cefc10e /src/mongo/db/service_context.cpp
parent757c434668e4936d6b2ac62131be7f12aeac25be (diff)
downloadmongo-30994f3bacb6e814ae015d83693c549a3b924ccc.tar.gz
SERVER-34798 Move storage initialization behaviors out of ServiceContext subclasses to new library.
Diffstat (limited to 'src/mongo/db/service_context.cpp')
-rw-r--r--src/mongo/db/service_context.cpp60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp
index 17193d9462a..92389a0f6a1 100644
--- a/src/mongo/db/service_context.cpp
+++ b/src/mongo/db/service_context.cpp
@@ -99,43 +99,6 @@ bool isMMAPV1() {
return globalStorageEngine->isMmapV1();
}
-Status validateStorageOptions(
- const BSONObj& storageEngineOptions,
- stdx::function<Status(const StorageEngine::Factory* const, const BSONObj&)> validateFunc) {
- BSONObjIterator storageIt(storageEngineOptions);
- while (storageIt.more()) {
- BSONElement storageElement = storageIt.next();
- StringData storageEngineName = storageElement.fieldNameStringData();
- if (storageElement.type() != mongo::Object) {
- return Status(ErrorCodes::BadValue,
- str::stream() << "'storageEngine." << storageElement.fieldNameStringData()
- << "' has to be an embedded document.");
- }
-
- std::unique_ptr<StorageFactoriesIterator> sfi(
- getGlobalServiceContext()->makeStorageFactoriesIterator());
- invariant(sfi);
- bool found = false;
- while (sfi->more()) {
- const StorageEngine::Factory* const& factory = sfi->next();
- if (storageEngineName != factory->getCanonicalName()) {
- continue;
- }
- Status status = validateFunc(factory, storageElement.Obj());
- if (!status.isOK()) {
- return status;
- }
- found = true;
- }
- if (!found) {
- return Status(ErrorCodes::InvalidOptions,
- str::stream() << storageEngineName
- << " is not a registered storage engine for this server");
- }
- }
- return Status::OK();
-}
-
ServiceContext::ServiceContext()
: _tickSource(stdx::make_unique<SystemTickSource>()),
_fastClockSource(stdx::make_unique<SystemClockSource>()),
@@ -300,29 +263,6 @@ Client* ServiceContext::LockedClientsCursor::next() {
return result;
}
-BSONArray storageEngineList() {
- if (!hasGlobalServiceContext())
- return BSONArray();
-
- std::unique_ptr<StorageFactoriesIterator> sfi(
- getGlobalServiceContext()->makeStorageFactoriesIterator());
-
- if (!sfi)
- return BSONArray();
-
- BSONArrayBuilder engineArrayBuilder;
-
- while (sfi->more()) {
- engineArrayBuilder.append(sfi->next()->getCanonicalName());
- }
-
- return engineArrayBuilder.arr();
-}
-
-void appendStorageEngineList(BSONObjBuilder* result) {
- result->append("storageEngines", storageEngineList());
-}
-
void ServiceContext::setKillAllOperations() {
stdx::lock_guard<stdx::mutex> clientLock(_mutex);