Storage Engine API
mongo::StorageEngine::Factory Class Referenceabstract

The interface for creating new instances of storage engines. More...

#include <storage_engine.h>

Detailed Description

The interface for creating new instances of storage engines.

A storage engine provides an instance of this class (along with an associated name) to the global environment, which then sets the global storage engine according to the provided configuration parameter.

Public Member Functions

virtual ~Factory ()
 
virtual StorageEnginecreate (const StorageGlobalParams &params, const StorageEngineLockFile *lockFile) const =0
 Return a new instance of the StorageEngine. More...
 
virtual StringData getCanonicalName () const =0
 Returns the name of the storage engine. More...
 
virtual Status validateCollectionStorageOptions (const BSONObj &options) const
 Validates creation options for a collection in the StorageEngine. More...
 
virtual Status validateIndexStorageOptions (const BSONObj &options) const
 Validates creation options for an index in the StorageEngine. More...
 
virtual Status validateMetadata (const StorageEngineMetadata &metadata, const StorageGlobalParams &params) const =0
 Validates existing metadata in the data directory against startup options. More...
 
virtual BSONObj createMetadataOptions (const StorageGlobalParams &params) const =0
 Returns a new document suitable for storing in the data directory metadata. More...
 
virtual bool supportsReadOnly () const
 Returns whether the engine supports read-only mode. More...
 

Constructor & Destructor Documentation

◆ ~Factory()

virtual mongo::StorageEngine::Factory::~Factory ( )
inlinevirtual

Member Function Documentation

◆ create()

virtual StorageEngine* mongo::StorageEngine::Factory::create ( const StorageGlobalParams params,
const StorageEngineLockFile lockFile 
) const
pure virtual

Return a new instance of the StorageEngine.

The lockFile parameter may be null if params.readOnly is set. Caller owns the returned pointer.

◆ createMetadataOptions()

virtual BSONObj mongo::StorageEngine::Factory::createMetadataOptions ( const StorageGlobalParams params) const
pure virtual

Returns a new document suitable for storing in the data directory metadata.

This document will be used by validateMetadata() to check startup options on restart.

◆ getCanonicalName()

virtual StringData mongo::StorageEngine::Factory::getCanonicalName ( ) const
pure virtual

Returns the name of the storage engine.

Implementations that change the value of the returned string can cause data file incompatibilities.

◆ supportsReadOnly()

virtual bool mongo::StorageEngine::Factory::supportsReadOnly ( ) const
inlinevirtual

Returns whether the engine supports read-only mode.

If read-only mode is enabled, the engine may be started on a read-only filesystem (either mounted read-only or with read-only permissions). If readOnly mode is enabled, it is undefined behavior to call methods that write data (e.g. insertRecord). This method is provided on the Factory because it must be called before the storageEngine is instantiated.

◆ validateCollectionStorageOptions()

virtual Status mongo::StorageEngine::Factory::validateCollectionStorageOptions ( const BSONObj &  options) const
inlinevirtual

Validates creation options for a collection in the StorageEngine.

Returns an error if the creation options are not valid.

Default implementation only accepts empty objects (no options).

◆ validateIndexStorageOptions()

virtual Status mongo::StorageEngine::Factory::validateIndexStorageOptions ( const BSONObj &  options) const
inlinevirtual

Validates creation options for an index in the StorageEngine.

Returns an error if the creation options are not valid.

Default implementation only accepts empty objects (no options).

◆ validateMetadata()

virtual Status mongo::StorageEngine::Factory::validateMetadata ( const StorageEngineMetadata metadata,
const StorageGlobalParams params 
) const
pure virtual

Validates existing metadata in the data directory against startup options.

Returns an error if the storage engine initialization should not proceed due to any inconsistencies between the current startup options and the creation options stored in the metadata.


The documentation for this class was generated from the following file: