summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/storage_engine_metadata.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/storage_engine_metadata.h')
-rw-r--r--src/mongo/db/storage/storage_engine_metadata.h151
1 files changed, 75 insertions, 76 deletions
diff --git a/src/mongo/db/storage/storage_engine_metadata.h b/src/mongo/db/storage/storage_engine_metadata.h
index a4dafdf9bfa..03873a851a9 100644
--- a/src/mongo/db/storage/storage_engine_metadata.h
+++ b/src/mongo/db/storage/storage_engine_metadata.h
@@ -38,83 +38,82 @@
namespace mongo {
+/**
+ * This reads and write the storage engine metadata file 'storage.bson'
+ * in the data directory (See --dbpath).
+ * 'storage.engine' is the only mandatory field in the BSON metadata file.
+ * Fields other than 'storage.engine' are ignored.
+ */
+class StorageEngineMetadata {
+ MONGO_DISALLOW_COPYING(StorageEngineMetadata);
+
+public:
+ /**
+ * Returns a metadata object describing the storage engine that backs the data files
+ * contained in 'dbpath', and nullptr otherwise.
+ */
+ static std::unique_ptr<StorageEngineMetadata> forPath(const std::string& dbpath);
+
+ /**
+ * Returns the name of the storage engine that backs the data files contained in 'dbpath',
+ * and none otherwise.
+ */
+ static boost::optional<std::string> getStorageEngineForPath(const std::string& dbpath);
+
+ /**
+ * Sets fields to defaults.
+ * Use read() load metadata from file.
+ */
+ StorageEngineMetadata(const std::string& dbpath);
+
+ virtual ~StorageEngineMetadata();
+
+ /**
+ * Returns name of storage engine in metadata.
+ */
+ const std::string& getStorageEngine() const;
+
+ /**
+ * Returns storage engine options in metadata.
+ */
+ const BSONObj& getStorageEngineOptions() const;
+
+ /**
+ * Sets name of storage engine in metadata.
+ */
+ void setStorageEngine(const std::string& storageEngine);
+
+ /**
+ * Sets storage engine options in metadata.
+ */
+ void setStorageEngineOptions(const BSONObj& storageEngineOptions);
+
+ /**
+ * Resets fields to default values.
+ */
+ void reset();
+
+ /**
+ * Reads metadata from 'storage.bson' in 'dbpath' directory.
+ */
+ Status read();
+
+ /**
+ * Writes metadata to file.
+ */
+ Status write() const;
+
/**
- * This reads and write the storage engine metadata file 'storage.bson'
- * in the data directory (See --dbpath).
- * 'storage.engine' is the only mandatory field in the BSON metadata file.
- * Fields other than 'storage.engine' are ignored.
+ * Validates a single field in the storage engine options.
+ * Currently, only boolean fields are supported.
*/
- class StorageEngineMetadata {
- MONGO_DISALLOW_COPYING(StorageEngineMetadata);
-
- public:
-
- /**
- * Returns a metadata object describing the storage engine that backs the data files
- * contained in 'dbpath', and nullptr otherwise.
- */
- static std::unique_ptr<StorageEngineMetadata> forPath(const std::string& dbpath);
-
- /**
- * Returns the name of the storage engine that backs the data files contained in 'dbpath',
- * and none otherwise.
- */
- static boost::optional<std::string> getStorageEngineForPath(const std::string& dbpath);
-
- /**
- * Sets fields to defaults.
- * Use read() load metadata from file.
- */
- StorageEngineMetadata(const std::string& dbpath);
-
- virtual ~StorageEngineMetadata();
-
- /**
- * Returns name of storage engine in metadata.
- */
- const std::string& getStorageEngine() const;
-
- /**
- * Returns storage engine options in metadata.
- */
- const BSONObj& getStorageEngineOptions() const;
-
- /**
- * Sets name of storage engine in metadata.
- */
- void setStorageEngine(const std::string& storageEngine);
-
- /**
- * Sets storage engine options in metadata.
- */
- void setStorageEngineOptions(const BSONObj& storageEngineOptions);
-
- /**
- * Resets fields to default values.
- */
- void reset();
-
- /**
- * Reads metadata from 'storage.bson' in 'dbpath' directory.
- */
- Status read();
-
- /**
- * Writes metadata to file.
- */
- Status write() const;
-
- /**
- * Validates a single field in the storage engine options.
- * Currently, only boolean fields are supported.
- */
- template <typename T>
- Status validateStorageEngineOption(StringData fieldName, T expectedValue) const;
-
- private:
- std::string _dbpath;
- std::string _storageEngine;
- BSONObj _storageEngineOptions;
- };
+ template <typename T>
+ Status validateStorageEngineOption(StringData fieldName, T expectedValue) const;
+
+private:
+ std::string _dbpath;
+ std::string _storageEngine;
+ BSONObj _storageEngineOptions;
+};
} // namespace mongo