Storage Engine API
mongo::KVEngine Class Referenceabstract

#include <kv_engine.h>

Inheritance diagram for mongo::KVEngine:
mongo::DevNullKVEngine mongo::EphemeralForTestEngine mongo::MobileKVEngine mongo::WiredTigerKVEngine

Public Member Functions

virtual RecoveryUnitnewRecoveryUnit ()=0
 
virtual std::unique_ptr< RecordStoregetRecordStore (OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options)=0
 Having multiple out for the same ns is a rules violation; Calling on a non-created ident is invalid and may crash. More...
 
virtual std::unique_ptr< RecordStoregetGroupedRecordStore (OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options, KVPrefix prefix)
 Get a RecordStore that may share an underlying table with other RecordStores. More...
 
virtual SortedDataInterfacegetSortedDataInterface (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc)=0
 
virtual SortedDataInterfacegetGroupedSortedDataInterface (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc, KVPrefix prefix)
 Get a SortedDataInterface that may share an underlying table with other SortedDataInterface. More...
 
virtual Status createRecordStore (OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options)=0
 The create and drop methods on KVEngine are not transactional. More...
 
virtual Status createGroupedRecordStore (OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options, KVPrefix prefix)
 Create a RecordStore that MongoDB considers eligible to share space in an underlying table with other RecordStores. More...
 
virtual Status createSortedDataInterface (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc)=0
 
virtual Status createGroupedSortedDataInterface (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc, KVPrefix prefix)
 Create a SortedDataInterface that MongoDB considers eligible to share space in an underlying table with other SortedDataInterfaces. More...
 
virtual int64_t getIdentSize (OperationContext *opCtx, StringData ident)=0
 
virtual Status repairIdent (OperationContext *opCtx, StringData ident)=0
 
virtual Status dropIdent (OperationContext *opCtx, StringData ident)=0
 
virtual void alterIdentMetadata (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc)
 
virtual int flushAllFiles (OperationContext *opCtx, bool sync)
 
virtual Status beginBackup (OperationContext *opCtx)
 See StorageEngine::beginBackup for details. More...
 
virtual void endBackup (OperationContext *opCtx)
 See StorageEngine::endBackup for details. More...
 
virtual bool isDurable () const =0
 
virtual bool isEphemeral () const =0
 Returns true if the KVEngine is ephemeral – that is, it is NOT persistent and all data is lost after shutdown. More...
 
virtual bool supportsDocLocking () const =0
 This must not change over the lifetime of the engine. More...
 
virtual bool supportsDBLocking () const
 This must not change over the lifetime of the engine. More...
 
virtual bool supportsCappedCollections () const
 This must not change over the lifetime of the engine. More...
 
virtual bool supportsDirectoryPerDB () const =0
 Returns true if storage engine supports –directoryperdb. More...
 
virtual Status okToRename (OperationContext *opCtx, StringData fromNS, StringData toNS, StringData ident, const RecordStore *originalRecordStore) const
 
virtual bool hasIdent (OperationContext *opCtx, StringData ident) const =0
 
virtual std::vector< std::string > getAllIdents (OperationContext *opCtx) const =0
 
virtual void cleanShutdown ()=0
 This method will be called before there is a clean shutdown. More...
 
virtual SnapshotManagergetSnapshotManager () const
 Return the SnapshotManager for this KVEngine or NULL if not supported. More...
 
virtual void setJournalListener (JournalListener *jl)=0
 Sets a new JournalListener, which is used to alert the rest of the system about journaled write progress. More...
 
virtual void setStableTimestamp (Timestamp stableTimestamp)
 See StorageEngine::setStableTimestamp More...
 
virtual void setInitialDataTimestamp (Timestamp initialDataTimestamp)
 See StorageEngine::setInitialDataTimestamp More...
 
virtual void setOldestTimestampFromStable ()
 See StorageEngine::setOldestTimestampFromStable More...
 
virtual void setOldestTimestamp (Timestamp newOldestTimestamp)
 See StorageEngine::setOldestTimestamp More...
 
virtual bool isCacheUnderPressure (OperationContext *opCtx) const
 See StorageEngine::isCacheUnderPressure() More...
 
virtual void setCachePressureForTest (int pressure)
 See 'StorageEngine::setCachePressureForTest()'. More...
 
virtual bool supportsRecoverToStableTimestamp () const
 See StorageEngine::supportsRecoverToStableTimestamp More...
 
virtual StatusWith< Timestamp > recoverToStableTimestamp (OperationContext *opCtx)
 See StorageEngine::recoverToStableTimestamp More...
 
virtual boost::optional< Timestamp > getRecoveryTimestamp () const
 See StorageEngine::getRecoveryTimestamp More...
 
virtual boost::optional< Timestamp > getLastStableCheckpointTimestamp () const
 See StorageEngine::getLastStableCheckpointTimestamp More...
 
virtual Timestamp getAllCommittedTimestamp () const =0
 See StorageEngine::getAllCommittedTimestamp More...
 
virtual bool supportsReadConcernSnapshot () const
 See StorageEngine::supportsReadConcernSnapshot More...
 
virtual void replicationBatchIsComplete () const
 See StorageEngine::replicationBatchIsComplete() More...
 
virtual ~KVEngine ()
 The destructor will never be called from mongod, but may be called from tests. More...
 

Constructor & Destructor Documentation

◆ ~KVEngine()

virtual mongo::KVEngine::~KVEngine ( )
inlinevirtual

The destructor will never be called from mongod, but may be called from tests.

Engines may assume that this will only be called in the case of clean shutdown, even if cleanShutdown() hasn't been called.

Member Function Documentation

◆ alterIdentMetadata()

virtual void mongo::KVEngine::alterIdentMetadata ( OperationContext *  opCtx,
StringData  ident,
const IndexDescriptor *  desc 
)
inlinevirtual

Reimplemented in mongo::WiredTigerKVEngine.

◆ beginBackup()

virtual Status mongo::KVEngine::beginBackup ( OperationContext *  opCtx)
inlinevirtual

◆ cleanShutdown()

virtual void mongo::KVEngine::cleanShutdown ( )
pure virtual

This method will be called before there is a clean shutdown.

Storage engines should override this method if they have clean-up to do that is different from unclean shutdown. MongoDB will not call into the storage subsystem after calling this function.

There is intentionally no uncleanShutdown().

Implemented in mongo::WiredTigerKVEngine, mongo::DevNullKVEngine, mongo::MobileKVEngine, and mongo::EphemeralForTestEngine.

◆ createGroupedRecordStore()

virtual Status mongo::KVEngine::createGroupedRecordStore ( OperationContext *  opCtx,
StringData  ns,
StringData  ident,
const CollectionOptions options,
KVPrefix  prefix 
)
inlinevirtual

Create a RecordStore that MongoDB considers eligible to share space in an underlying table with other RecordStores.

'prefix' is guaranteed to be 'KVPrefix::kNotPrefixed' when 'groupCollections' is not enabled.

Parameters
prefixsignals whether the RecordStore may be shared by an underlying table. A prefix of KVPrefix::kNotPrefixed must remain isolated in its own table. Otherwise the storage engine implementation ultimately chooses which RecordStores share a table. Sharing RecordStores belonging to different databases within the same table is forbidden.

Reimplemented in mongo::WiredTigerKVEngine.

◆ createGroupedSortedDataInterface()

virtual Status mongo::KVEngine::createGroupedSortedDataInterface ( OperationContext *  opCtx,
StringData  ident,
const IndexDescriptor *  desc,
KVPrefix  prefix 
)
inlinevirtual

Create a SortedDataInterface that MongoDB considers eligible to share space in an underlying table with other SortedDataInterfaces.

'prefix' is guaranteed to be 'KVPrefix::kNotPrefixed' when 'groupCollections' is not enabled.

Parameters
prefixsignals whether the SortedDataInterface (index) may be shared by an underlying table. A prefix of KVPrefix::kNotPrefixed must remain isolated in its own table. Otherwise the storage engine implementation ultimately chooses which indexes share a table. Sharing indexes belonging to different databases is forbidden.

Reimplemented in mongo::WiredTigerKVEngine.

◆ createRecordStore()

virtual Status mongo::KVEngine::createRecordStore ( OperationContext *  opCtx,
StringData  ns,
StringData  ident,
const CollectionOptions options 
)
pure virtual

The create and drop methods on KVEngine are not transactional.

Transactional semantics are provided by the KVStorageEngine code that calls these. For example, drop will be called if a create is rolled back. A higher-level drop operation will only propagate to a drop call on the KVEngine once the WUOW commits. Therefore drops will never be rolled back and it is safe to immediately reclaim storage.

Implemented in mongo::WiredTigerKVEngine, mongo::DevNullKVEngine, mongo::MobileKVEngine, and mongo::EphemeralForTestEngine.

◆ createSortedDataInterface()

virtual Status mongo::KVEngine::createSortedDataInterface ( OperationContext *  opCtx,
StringData  ident,
const IndexDescriptor *  desc 
)
pure virtual

◆ dropIdent()

virtual Status mongo::KVEngine::dropIdent ( OperationContext *  opCtx,
StringData  ident 
)
pure virtual

◆ endBackup()

virtual void mongo::KVEngine::endBackup ( OperationContext *  opCtx)
inlinevirtual

◆ flushAllFiles()

virtual int mongo::KVEngine::flushAllFiles ( OperationContext *  opCtx,
bool  sync 
)
inlinevirtual

◆ getAllCommittedTimestamp()

virtual Timestamp mongo::KVEngine::getAllCommittedTimestamp ( ) const
pure virtual

◆ getAllIdents()

virtual std::vector<std::string> mongo::KVEngine::getAllIdents ( OperationContext *  opCtx) const
pure virtual

◆ getGroupedRecordStore()

virtual std::unique_ptr<RecordStore> mongo::KVEngine::getGroupedRecordStore ( OperationContext *  opCtx,
StringData  ns,
StringData  ident,
const CollectionOptions options,
KVPrefix  prefix 
)
inlinevirtual

Get a RecordStore that may share an underlying table with other RecordStores.

'prefix' is guaranteed to be 'KVPrefix::kNotPrefixed' when 'groupCollections' is not enabled.

Parameters
prefixdictates the value keys for the RecordStore should be prefixed with to distinguish between RecordStores sharing an underlying table. A value of KVPrefix::kNotPrefixed guarantees the index is the sole resident of the table.

Reimplemented in mongo::WiredTigerKVEngine.

◆ getGroupedSortedDataInterface()

virtual SortedDataInterface* mongo::KVEngine::getGroupedSortedDataInterface ( OperationContext *  opCtx,
StringData  ident,
const IndexDescriptor *  desc,
KVPrefix  prefix 
)
inlinevirtual

Get a SortedDataInterface that may share an underlying table with other SortedDataInterface.

'prefix' is guaranteed to be 'KVPrefix::kNotPrefixed' when 'groupCollections' is not enabled.

Parameters
prefixdictates the value keys for the index should be prefixed with to distinguish between indexes sharing an underlying table. A value of KVPrefix::kNotPrefixed guarantees the index is the sole resident of the table.

Reimplemented in mongo::WiredTigerKVEngine.

◆ getIdentSize()

virtual int64_t mongo::KVEngine::getIdentSize ( OperationContext *  opCtx,
StringData  ident 
)
pure virtual

◆ getLastStableCheckpointTimestamp()

virtual boost::optional<Timestamp> mongo::KVEngine::getLastStableCheckpointTimestamp ( ) const
inlinevirtual

◆ getRecordStore()

virtual std::unique_ptr<RecordStore> mongo::KVEngine::getRecordStore ( OperationContext *  opCtx,
StringData  ns,
StringData  ident,
const CollectionOptions options 
)
pure virtual

Having multiple out for the same ns is a rules violation; Calling on a non-created ident is invalid and may crash.

Implemented in mongo::WiredTigerKVEngine, mongo::DevNullKVEngine, mongo::MobileKVEngine, and mongo::EphemeralForTestEngine.

◆ getRecoveryTimestamp()

virtual boost::optional<Timestamp> mongo::KVEngine::getRecoveryTimestamp ( ) const
inlinevirtual

◆ getSnapshotManager()

virtual SnapshotManager* mongo::KVEngine::getSnapshotManager ( ) const
inlinevirtual

Return the SnapshotManager for this KVEngine or NULL if not supported.

Pointer remains owned by the StorageEngine, not the caller.

Reimplemented in mongo::WiredTigerKVEngine.

◆ getSortedDataInterface()

virtual SortedDataInterface* mongo::KVEngine::getSortedDataInterface ( OperationContext *  opCtx,
StringData  ident,
const IndexDescriptor *  desc 
)
pure virtual

◆ hasIdent()

virtual bool mongo::KVEngine::hasIdent ( OperationContext *  opCtx,
StringData  ident 
) const
pure virtual

◆ isCacheUnderPressure()

virtual bool mongo::KVEngine::isCacheUnderPressure ( OperationContext *  opCtx) const
inlinevirtual

◆ isDurable()

virtual bool mongo::KVEngine::isDurable ( ) const
pure virtual

◆ isEphemeral()

virtual bool mongo::KVEngine::isEphemeral ( ) const
pure virtual

Returns true if the KVEngine is ephemeral – that is, it is NOT persistent and all data is lost after shutdown.

Otherwise, returns false.

Implemented in mongo::MobileKVEngine, mongo::DevNullKVEngine, mongo::WiredTigerKVEngine, and mongo::EphemeralForTestEngine.

◆ newRecoveryUnit()

virtual RecoveryUnit* mongo::KVEngine::newRecoveryUnit ( )
pure virtual

◆ okToRename()

virtual Status mongo::KVEngine::okToRename ( OperationContext *  opCtx,
StringData  fromNS,
StringData  toNS,
StringData  ident,
const RecordStore originalRecordStore 
) const
inlinevirtual

Reimplemented in mongo::WiredTigerKVEngine.

◆ recoverToStableTimestamp()

virtual StatusWith<Timestamp> mongo::KVEngine::recoverToStableTimestamp ( OperationContext *  opCtx)
inlinevirtual

◆ repairIdent()

virtual Status mongo::KVEngine::repairIdent ( OperationContext *  opCtx,
StringData  ident 
)
pure virtual

◆ replicationBatchIsComplete()

virtual void mongo::KVEngine::replicationBatchIsComplete ( ) const
inlinevirtual

◆ setCachePressureForTest()

virtual void mongo::KVEngine::setCachePressureForTest ( int  pressure)
inlinevirtual

◆ setInitialDataTimestamp()

virtual void mongo::KVEngine::setInitialDataTimestamp ( Timestamp  initialDataTimestamp)
inlinevirtual

◆ setJournalListener()

virtual void mongo::KVEngine::setJournalListener ( JournalListener jl)
pure virtual

Sets a new JournalListener, which is used to alert the rest of the system about journaled write progress.

Implemented in mongo::WiredTigerKVEngine, mongo::DevNullKVEngine, mongo::MobileKVEngine, and mongo::EphemeralForTestEngine.

◆ setOldestTimestamp()

virtual void mongo::KVEngine::setOldestTimestamp ( Timestamp  newOldestTimestamp)
inlinevirtual

◆ setOldestTimestampFromStable()

virtual void mongo::KVEngine::setOldestTimestampFromStable ( )
inlinevirtual

◆ setStableTimestamp()

virtual void mongo::KVEngine::setStableTimestamp ( Timestamp  stableTimestamp)
inlinevirtual

◆ supportsCappedCollections()

virtual bool mongo::KVEngine::supportsCappedCollections ( ) const
inlinevirtual

This must not change over the lifetime of the engine.

Reimplemented in mongo::MobileKVEngine.

◆ supportsDBLocking()

virtual bool mongo::KVEngine::supportsDBLocking ( ) const
inlinevirtual

This must not change over the lifetime of the engine.

Reimplemented in mongo::MobileKVEngine.

◆ supportsDirectoryPerDB()

virtual bool mongo::KVEngine::supportsDirectoryPerDB ( ) const
pure virtual

◆ supportsDocLocking()

virtual bool mongo::KVEngine::supportsDocLocking ( ) const
pure virtual

This must not change over the lifetime of the engine.

Implemented in mongo::WiredTigerKVEngine, mongo::DevNullKVEngine, mongo::MobileKVEngine, and mongo::EphemeralForTestEngine.

◆ supportsReadConcernSnapshot()

virtual bool mongo::KVEngine::supportsReadConcernSnapshot ( ) const
inlinevirtual

◆ supportsRecoverToStableTimestamp()

virtual bool mongo::KVEngine::supportsRecoverToStableTimestamp ( ) const
inlinevirtual

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