Storage Engine API
mongo::MobileRecordStore::Cursor Class Referencefinal
Inheritance diagram for mongo::MobileRecordStore::Cursor:
mongo::SeekableRecordCursor mongo::RecordCursor

Public Member Functions

 Cursor (OperationContext *opCtx, const MobileRecordStore &rs, const std::string &path, const std::string &ident, bool forward)
 
boost::optional< Recordnext () final
 Moves forward and returns the new data or boost::none if there is no more data. More...
 
boost::optional< RecordseekExact (const RecordId &id) final
 Seeks to a Record with the provided id. More...
 
void save () final
 Prepares for state changes in underlying data in a way that allows the cursor's current position to be restored. More...
 
void saveUnpositioned () final
 Prepares for state changes in underlying data without necessarily saving the current state. More...
 
bool restore () final
 Recovers from potential state changes in underlying data. More...
 
void detachFromOperationContext () final
 Detaches from the OperationContext and releases any storage-engine state. More...
 
void reattachToOperationContext (OperationContext *opCtx) final
 Reattaches to the OperationContext and reacquires any storage-engine state. More...
 
- Public Member Functions inherited from mongo::SeekableRecordCursor
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 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...
 

Private Member Functions

void _resetStatement ()
 Resets the prepared statement. More...
 

Private Attributes

OperationContext * _opCtx
 
std::unique_ptr< SqliteStatement_stmt
 
bool _eof = false
 
RecordId _savedId
 
int64_t _startIdNum
 
const bool _isCapped
 
const bool _forward
 

Constructor & Destructor Documentation

◆ Cursor()

mongo::MobileRecordStore::Cursor::Cursor ( OperationContext *  opCtx,
const MobileRecordStore rs,
const std::string &  path,
const std::string &  ident,
bool  forward 
)
inline

Member Function Documentation

◆ _resetStatement()

void mongo::MobileRecordStore::Cursor::_resetStatement ( )
inlineprivate

Resets the prepared statement.

◆ detachFromOperationContext()

void mongo::MobileRecordStore::Cursor::detachFromOperationContext ( )
inlinefinalvirtual

Detaches from the OperationContext and releases any storage-engine state.

It is only legal to call this when in a "saved" state. While in the "detached" state, it is only legal to call reattachToOperationContext or the destructor. It is not legal to call detachFromOperationContext() while already in the detached state.

Implements mongo::RecordCursor.

◆ next()

boost::optional<Record> mongo::MobileRecordStore::Cursor::next ( )
inlinefinalvirtual

Moves forward and returns the new data or boost::none if there is no more data.

Continues returning boost::none once it reaches EOF.

Implements mongo::RecordCursor.

◆ reattachToOperationContext()

void mongo::MobileRecordStore::Cursor::reattachToOperationContext ( OperationContext *  opCtx)
inlinefinalvirtual

Reattaches to the OperationContext and reacquires any storage-engine state.

It is only legal to call this in the "detached" state. On return, the cursor is left in a "saved" state, so callers must still call restoreState to use this object.

Implements mongo::RecordCursor.

◆ restore()

bool mongo::MobileRecordStore::Cursor::restore ( )
inlinefinalvirtual

Recovers from potential state changes in underlying data.

Returns false if it is invalid to continue using this iterator. This usually means that capped deletes have caught up to the position of this iterator and continuing could result in missed data.

If the former position no longer exists, but it is safe to continue iterating, the following call to next() will return the next closest position in the direction of the scan, if any.

This handles restoring after either save() or SeekableRecordCursor::saveUnpositioned().

Implements mongo::RecordCursor.

◆ save()

void mongo::MobileRecordStore::Cursor::save ( )
inlinefinalvirtual

Prepares for state changes in underlying data in a way that allows the cursor's current position to be restored.

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

Implements mongo::RecordCursor.

◆ saveUnpositioned()

void mongo::MobileRecordStore::Cursor::saveUnpositioned ( )
inlinefinalvirtual

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 from mongo::SeekableRecordCursor.

◆ seekExact()

boost::optional<Record> mongo::MobileRecordStore::Cursor::seekExact ( const RecordId &  id)
inlinefinalvirtual

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.

Implements mongo::SeekableRecordCursor.

Member Data Documentation

◆ _eof

bool mongo::MobileRecordStore::Cursor::_eof = false
private

◆ _forward

const bool mongo::MobileRecordStore::Cursor::_forward
private

◆ _isCapped

const bool mongo::MobileRecordStore::Cursor::_isCapped
private

◆ _opCtx

OperationContext* mongo::MobileRecordStore::Cursor::_opCtx
private

◆ _savedId

RecordId mongo::MobileRecordStore::Cursor::_savedId
private

◆ _startIdNum

int64_t mongo::MobileRecordStore::Cursor::_startIdNum
private

◆ _stmt

std::unique_ptr<SqliteStatement> mongo::MobileRecordStore::Cursor::_stmt
private

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