Skip to main content

IndexCursor

Trait IndexCursor 

Source
pub trait IndexCursor: Send + Debug {
    type Row: Send;

    // Required method
    fn next_batch(
        &mut self,
        batch_size: usize,
    ) -> Result<Vec<Self::Row>, StorageError>;

    // Provided methods
    fn stale_skipped(&self) -> u64 { ... }
    fn invisible_skipped(&self) -> u64 { ... }
    fn malformed_skipped(&self) -> u64 { ... }
    fn is_exhausted(&self) -> bool { ... }
}
Expand description

A cursor that yields index entries (row IDs or covering rows) in batches.

Bound to a transaction snapshot at creation time. Supports equality, range, and prefix predicates as available in the storage engine. Unsupported predicate types return an error at open time, not at runtime.

Required Associated Types§

Source

type Row: Send

The type of row identifier this cursor yields.

Required Methods§

Source

fn next_batch( &mut self, batch_size: usize, ) -> Result<Vec<Self::Row>, StorageError>

Read the next batch of index entries (at most batch_size).

Returns an empty Vec when exhausted. Stale or deleted row IDs are counted but skipped — they do not cause premature exhaustion.

Provided Methods§

Source

fn stale_skipped(&self) -> u64

Number of stale rows skipped so far (for diagnostics).

Source

fn invisible_skipped(&self) -> u64

Number of invisible (MVCC-hidden) entries skipped so far.

Source

fn malformed_skipped(&self) -> u64

Number of malformed/unparseable entries skipped so far.

Source

fn is_exhausted(&self) -> bool

Whether the cursor has reached the end of its physical scan.

A batch may be empty even before exhaustion when all entries in that batch are invisible or stale, so callers that need to continue over such entries must inspect this flag.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§