36 #include "mongo/base/status.h" 37 #include "mongo/bson/bsonobj.h" 38 #include "mongo/bson/timestamp.h" 39 #include "mongo/util/mongoutils/str.h" 43 class DatabaseCatalogEntry;
44 class JournalListener;
45 class OperationContext;
47 class SnapshotManager;
48 struct StorageGlobalParams;
49 class StorageEngineLockFile;
50 class StorageEngineMetadata;
92 if (options.isEmpty())
94 return Status(ErrorCodes::InvalidOptions,
96 <<
" does not support any collection storage options");
106 if (options.isEmpty())
108 return Status(ErrorCodes::InvalidOptions,
110 <<
" does not support any index storage options");
166 virtual void listDatabases(std::vector<std::string>* out)
const = 0;
239 virtual int flushAllFiles(OperationContext* opCtx,
bool sync) = 0;
261 return Status(ErrorCodes::CommandNotSupported,
262 "The current storage engine doesn't support backup mode");
346 fassertFailed(40547);
432 OperationContext* opCtx) {
433 return std::vector<CollectionIndexNamePair>();
virtual ~Factory()
Definition: storage_engine.h:68
virtual StorageEngine * create(const StorageGlobalParams ¶ms, const StorageEngineLockFile *lockFile) const =0
Return a new instance of the StorageEngine.
virtual void replicationBatchIsComplete() const
Notifies the storage engine that a replication batch has completed.
Definition: storage_engine.h:422
virtual void finishInit()
Called after the globalStorageEngine pointer has been set up, before any other methods are called...
Definition: storage_engine.h:151
virtual void closeCatalog(OperationContext *opCtx)
Definition: storage_engine.h:224
virtual int flushAllFiles(OperationContext *opCtx, bool sync)=0
Collection *const const NamespaceString & ns
Definition: collection_info_cache_impl.cpp:53
virtual Status beginBackup(OperationContext *opCtx)
Transitions the storage engine into backup mode.
Definition: storage_engine.h:260
virtual void loadCatalog(OperationContext *opCtx)
Populates and tears down in-memory data structures, respectively.
Definition: storage_engine.h:223
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
virtual void setOldestTimestamp(Timestamp timestamp)
Sets the oldest timestamp for which the storage engine must maintain snapshot history through...
Definition: storage_engine.h:396
virtual ~StorageEngine()
The destructor should only be called if we are tearing down but not exiting the process.
Definition: storage_engine.h:144
OperationContext Database StringData BSONObj CollectionOptions::ParseKind bool const BSONObj &idIndex Status
Definition: database_impl.cpp:956
virtual Status repairRecordStore(OperationContext *opCtx, const std::string &ns)=0
Recover as much data as possible from a potentially corrupt RecordStore.
virtual bool isCacheUnderPressure(OperationContext *opCtx) const
Indicates whether the storage engine cache is under pressure.
Definition: storage_engine.h:405
virtual bool isDurable() const =0
Returns whether the engine supports a journalling concept or not.
Definition: storage_options.h:46
virtual Status dropDatabase(OperationContext *opCtx, StringData db)=0
Deletes all data and metadata for a database.
virtual void setInitialDataTimestamp(Timestamp timestamp)
Tells the storage engine the timestamp of the data at startup.
Definition: storage_engine.h:378
virtual bool isEphemeral() const =0
Returns true if the engine does not persist data to disk; false otherwise.
virtual bool supportsReadConcernSnapshot() const
Returns true if the storage engine supports the readConcern level "snapshot".
Definition: storage_engine.h:325
virtual StatusWith< std::vector< CollectionIndexNamePair > > reconcileCatalogAndIdents(OperationContext *opCtx)
Drop abandoned idents.
Definition: storage_engine.h:431
virtual void listDatabases(std::vector< std::string > *out) const =0
List the databases stored in this storage engine.
This class allows for the storageEngine to alert the rest of the system about journaled write progres...
Definition: journal_listener.h:48
virtual BSONObj createMetadataOptions(const StorageGlobalParams ¶ms) const =0
Returns a new document suitable for storing in the data directory metadata.
virtual void setJournalListener(JournalListener *jl)=0
Sets a new JournalListener, which is used by the storage engine to alert the rest of the system about...
virtual boost::optional< Timestamp > getRecoveryTimestamp() const
Returns the stable timestamp that the storage engine recovered to on startup.
Definition: storage_engine.h:354
virtual void setOldestTimestampFromStable()
Uses the current stable timestamp to set the oldest timestamp for which the storage engine must maint...
Definition: storage_engine.h:390
Definition: index_key_validate.h:40
A RecoveryUnit is responsible for ensuring that data is persisted.
Definition: recovery_unit.h:51
virtual StatusWith< Timestamp > recoverToStableTimestamp(OperationContext *opCtx)
Recovers the storage engine state to the last stable timestamp.
Definition: storage_engine.h:345
virtual bool isMmapV1() const
Only MMAPv1 should override this and return true to trigger MMAPv1-specific behavior.
Definition: storage_engine.h:213
virtual Timestamp getAllCommittedTimestamp() const =0
Returns the all committed timestamp.
virtual bool supportsDBLocking() const
Returns whether the storage engine supports locking at a database level.
Definition: storage_engine.h:189
virtual void endBackup(OperationContext *opCtx)
Transitions the storage engine out of backup mode.
Definition: storage_engine.h:272
Definition: database_catalog_entry.h:50
virtual bool supportsCappedCollections() const
Returns whether the storage engine supports capped collections.
Definition: storage_engine.h:196
virtual boost::optional< Timestamp > getLastStableCheckpointTimestamp() const
Returns a timestamp that is guaranteed to be persisted to disk in a checkpoint.
Definition: storage_engine.h:364
std::pair< std::string, std::string > CollectionIndexNamePair
Definition: storage_engine.h:422
OperationContext Database * db
Definition: database_impl.cpp:949
virtual Status closeDatabase(OperationContext *opCtx, StringData db)=0
Closes all file handles associated with a database.
OperationContext Database StringData BSONObj options
Definition: database_impl.cpp:949
The interface for creating new instances of storage engines.
Definition: storage_engine.h:66
virtual bool supportsReadOnly() const
Returns whether the engine supports read-only mode.
Definition: storage_engine.h:136
virtual RecoveryUnit * newRecoveryUnit()=0
Returns a new interface to the storage engine's recovery unit.
Manages snapshots that can be read from at a later time.
Definition: snapshot_manager.h:47
virtual Status validateCollectionStorageOptions(const BSONObj &options) const
Validates creation options for a collection in the StorageEngine.
Definition: storage_engine.h:91
virtual Status validateMetadata(const StorageEngineMetadata &metadata, const StorageGlobalParams ¶ms) const =0
Validates existing metadata in the data directory against startup options.
virtual Status validateIndexStorageOptions(const BSONObj &options) const
Validates creation options for an index in the StorageEngine.
Definition: storage_engine.h:105
Definition: storage_engine_lock_file.h:41
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
virtual void setStableTimestamp(Timestamp timestamp)
Sets the highest timestamp at which the storage engine is allowed to take a checkpoint.
Definition: storage_engine.h:372
virtual void setCachePressureForTest(int pressure)
For unit tests only.
Definition: storage_engine.h:413
virtual bool supportsRecoverToStableTimestamp() const
Returns whether the storage engine supports "recover to stable timestamp".
Definition: storage_engine.h:318
The StorageEngine class is the top level interface for creating a new storage engine.
Definition: storage_engine.h:57
virtual DatabaseCatalogEntry * getDatabaseCatalogEntry(OperationContext *opCtx, StringData db)=0
Return the DatabaseCatalogEntry that describes the database indicated by 'db'.
virtual SnapshotManager * getSnapshotManager() const
Returns the SnapshotManager for this StorageEngine or NULL if not supported.
Definition: storage_engine.h:302
virtual StringData getCanonicalName() const =0
Returns the name of the storage engine.
virtual bool supportsDocLocking() const =0
Returns whether the storage engine supports its own locking locking below the collection level...
virtual void cleanShutdown()=0
This method will be called before there is a clean shutdown.