reth_db_api::cursor

Trait DbCursorRO

source
pub trait DbCursorRO<T: Table> {
    // Required methods
    fn first(&mut self) -> PairResult<T>;
    fn seek_exact(&mut self, key: T::Key) -> PairResult<T>;
    fn seek(&mut self, key: T::Key) -> PairResult<T>;
    fn next(&mut self) -> PairResult<T>;
    fn prev(&mut self) -> PairResult<T>;
    fn last(&mut self) -> PairResult<T>;
    fn current(&mut self) -> PairResult<T>;
    fn walk(
        &mut self,
        start_key: Option<T::Key>,
    ) -> Result<Walker<'_, T, Self>, DatabaseError>
       where Self: Sized;
    fn walk_range(
        &mut self,
        range: impl RangeBounds<T::Key>,
    ) -> Result<RangeWalker<'_, T, Self>, DatabaseError>
       where Self: Sized;
    fn walk_back(
        &mut self,
        start_key: Option<T::Key>,
    ) -> Result<ReverseWalker<'_, T, Self>, DatabaseError>
       where Self: Sized;
}
Expand description

A read-only cursor over table T.

Required Methods§

source

fn first(&mut self) -> PairResult<T>

Positions the cursor at the first entry in the table, returning it.

source

fn seek_exact(&mut self, key: T::Key) -> PairResult<T>

Seeks to the KV pair exactly at key.

source

fn seek(&mut self, key: T::Key) -> PairResult<T>

Seeks to the KV pair whose key is greater than or equal to key.

source

fn next(&mut self) -> PairResult<T>

Position the cursor at the next KV pair, returning it.

source

fn prev(&mut self) -> PairResult<T>

Position the cursor at the previous KV pair, returning it.

source

fn last(&mut self) -> PairResult<T>

Positions the cursor at the last entry in the table, returning it.

source

fn current(&mut self) -> PairResult<T>

Get the KV pair at the cursor’s current position.

source

fn walk( &mut self, start_key: Option<T::Key>, ) -> Result<Walker<'_, T, Self>, DatabaseError>
where Self: Sized,

Get an iterator that walks through the table.

If start_key is None, then the walker will start from the first entry of the table, otherwise it starts at the entry greater than or equal to the provided key.

source

fn walk_range( &mut self, range: impl RangeBounds<T::Key>, ) -> Result<RangeWalker<'_, T, Self>, DatabaseError>
where Self: Sized,

Get an iterator that walks over a range of keys in the table.

source

fn walk_back( &mut self, start_key: Option<T::Key>, ) -> Result<ReverseWalker<'_, T, Self>, DatabaseError>
where Self: Sized,

Get an iterator that walks through the table in reverse order.

If start_key is None, then the walker will start from the last entry of the table, otherwise it starts at the entry greater than or equal to the provided key.

Implementors§