Storage Engine API
storage_engine_init.h
Go to the documentation of this file.
1 
29 #pragma once
30 
31 #include <memory>
32 
33 #include "mongo/base/string_data.h"
34 #include "mongo/db/service_context.h"
36 
37 namespace mongo {
38 
42 void initializeStorageEngine(ServiceContext* service);
43 
47 void shutdownGlobalStorageEngineCleanly(ServiceContext* service);
48 
53 void createLockFile(ServiceContext* service);
54 
58 void registerStorageEngine(ServiceContext* service,
59  std::unique_ptr<StorageEngine::Factory> factory);
60 
64 bool isRegisteredStorageEngine(ServiceContext* service, StringData name);
65 
71 StorageEngine::Factory* getFactoryForStorageEngine(ServiceContext* context, StringData name);
72 
73 /*
74  * Extracts the storageEngine bson from the CollectionOptions provided. Loops through each
75  * provided storageEngine and asks the matching registered storage engine if the
76  * collection/index options are valid. Returns an error if the collection/index options are
77  * invalid.
78  * If no matching registered storage engine is found, return an error.
79  * Validation function 'func' must be either:
80  * - &StorageEngine::Factory::validateCollectionStorageOptions; or
81  * - &StorageEngine::Factory::validateIndexStorageOptions
82  */
84  ServiceContext* service,
85  const BSONObj& storageEngineOptions,
86  stdx::function<Status(const StorageEngine::Factory* const, const BSONObj&)> validateFunc);
87 
88 /*
89  * Appends a the list of available storage engines to a BSONObjBuilder for reporting purposes.
90  */
91 void appendStorageEngineList(ServiceContext* service, BSONObjBuilder* result);
92 
93 } // namespace mongo
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
OperationContext Database StringData BSONObj CollectionOptions::ParseKind bool const BSONObj &idIndex Status
Definition: database_impl.cpp:956
StorageEngine::Factory * getFactoryForStorageEngine(ServiceContext *service, StringData name)
Returns an unowned pointer to the factory for the named storage engine, or nullptr.
Definition: storage_engine_init.cpp:252
Status validateStorageOptions(ServiceContext *service, const BSONObj &storageEngineOptions, stdx::function< Status(const StorageEngine::Factory *const, const BSONObj &)> validateFunc)
Definition: storage_engine_init.cpp:260
ServiceContextNoop service
Definition: kv_engine_test_timestamps.cpp:203
InitializerContext * context
Definition: devnull_init.cpp:69
void registerStorageEngine(ServiceContext *service, std::unique_ptr< StorageEngine::Factory > factory)
Registers a storage engine onto the given "service".
Definition: storage_engine_init.cpp:233
void createLockFile(ServiceContext *service)
Creates the lock file used to prevent concurrent processes from accessing the data files...
Definition: storage_engine_init.cpp:194
void initializeStorageEngine(ServiceContext *service)
Initializes the storage engine on "service".
Definition: storage_engine_init.cpp:50
bool isRegisteredStorageEngine(ServiceContext *service, StringData name)
Returns true if "name" refers to a registered storage engine.
Definition: storage_engine_init.cpp:248
Database *const OperationContext *const const StringData name
Definition: database_impl.cpp:82
void shutdownGlobalStorageEngineCleanly(ServiceContext *service)
Shuts down storage engine cleanly and releases any locks on mongod.lock.
Definition: storage_engine_init.cpp:185
void appendStorageEngineList(ServiceContext *service, BSONObjBuilder *result)
Definition: storage_engine_init.cpp:304