Storage Engine API
mongo::SeekableRecordCursor Class Referenceabstract

Adds explicit seeking of records. More...

#include <record_store.h>

Inheritance diagram for mongo::SeekableRecordCursor:
mongo::RecordCursor mongo::CappedRecordStoreV1Iterator mongo::EmptyRecordCursor mongo::EphemeralForTestRecordStore::Cursor mongo::EphemeralForTestRecordStore::ReverseCursor mongo::MobileRecordStore::Cursor mongo::SimpleRecordStoreV1Iterator mongo::WiredTigerRecordStoreCursorBase mongo::WiredTigerRecordStorePrefixedCursor mongo::WiredTigerRecordStoreStandardCursor

Detailed Description

Adds explicit seeking of records.

This functionality is separated out from RecordCursor, because some cursors, such as repair cursors, are not required to support seeking.

Warning: MMAPv1 cannot detect if RecordIds are valid. Therefore callers should only pass potentially deleted RecordIds to seek methods if they know that MMAPv1 is not the current storage engine. All new storage engines must support detecting the existence of Records.

Public Member Functions

virtual boost::optional< RecordseekExact (const RecordId &id)=0
 Seeks to a Record with the provided id. More...
 
virtual void saveUnpositioned ()
 Prepares for state changes in underlying data without necessarily saving the current state. More...
 
virtual std::unique_ptr< RecordFetcherfetcherForId (const RecordId &id) const
 Returns a RecordFetcher if needed to fetch the provided Record or none if unneeded. More...
 
- Public Member Functions inherited from mongo::RecordCursor
virtual ~RecordCursor ()=default
 
virtual boost::optional< Recordnext ()=0
 Moves forward and returns the new data or boost::none if there is no more data. More...
 
virtual void save ()=0
 Prepares for state changes in underlying data in a way that allows the cursor's current position to be restored. More...
 
virtual bool restore ()=0
 Recovers from potential state changes in underlying data. More...
 
virtual void detachFromOperationContext ()=0
 Detaches from the OperationContext and releases any storage-engine state. More...
 
virtual void reattachToOperationContext (OperationContext *opCtx)=0
 Reattaches to the OperationContext and reacquires any storage-engine state. More...
 
virtual void invalidate (OperationContext *opCtx, const RecordId &id)
 Inform the cursor that this id is being invalidated. More...
 
virtual std::unique_ptr< RecordFetcherfetcherForNext () const
 Returns a RecordFetcher if needed for a call to next() or none if unneeded. More...
 

Member Function Documentation

◆ fetcherForId()

virtual std::unique_ptr<RecordFetcher> mongo::SeekableRecordCursor::fetcherForId ( const RecordId &  id) const
inlinevirtual

Returns a RecordFetcher if needed to fetch the provided Record or none if unneeded.

Reimplemented in mongo::CappedRecordStoreV1Iterator, and mongo::SimpleRecordStoreV1Iterator.

◆ saveUnpositioned()

virtual void mongo::SeekableRecordCursor::saveUnpositioned ( )
inlinevirtual

Prepares for state changes in underlying data without necessarily saving the current state.

The cursor's position when restored is unspecified. Caller is expected to seek rather than call next() following the restore.

It is safe to call saveUnpositioned multiple times in a row. No other method (excluding destructor) may be called until successfully restored.

Reimplemented in mongo::WiredTigerRecordStoreCursorBase, mongo::EphemeralForTestRecordStore::ReverseCursor, mongo::EphemeralForTestRecordStore::Cursor, and mongo::MobileRecordStore::Cursor.

◆ seekExact()

virtual boost::optional<Record> mongo::SeekableRecordCursor::seekExact ( const RecordId &  id)
pure virtual

Seeks to a Record with the provided id.

If an exact match can't be found, boost::none will be returned and the resulting position of the cursor is unspecified.

Implemented in mongo::WiredTigerRecordStoreCursorBase, mongo::EphemeralForTestRecordStore::ReverseCursor, mongo::EphemeralForTestRecordStore::Cursor, mongo::MobileRecordStore::Cursor, mongo::CappedRecordStoreV1Iterator, mongo::SimpleRecordStoreV1Iterator, and mongo::EmptyRecordCursor.


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