![]() |
Storage Engine API
|
Adds explicit seeking of records. More...
#include <record_store.h>
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< Record > | seekExact (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< RecordFetcher > | fetcherForId (const RecordId &id) const |
Returns a RecordFetcher if needed to fetch the provided Record or none if unneeded. More... | |
![]() | |
virtual | ~RecordCursor ()=default |
virtual boost::optional< Record > | next ()=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< RecordFetcher > | fetcherForNext () const |
Returns a RecordFetcher if needed for a call to next() or none if unneeded. More... | |
|
inlinevirtual |
Returns a RecordFetcher if needed to fetch the provided Record or none if unneeded.
Reimplemented in mongo::CappedRecordStoreV1Iterator, and mongo::SimpleRecordStoreV1Iterator.
|
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.
|
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.