reth_db::cursor

Trait DbCursorRW

pub trait DbCursorRW<T>
where T: Table,
{ // Required methods fn upsert( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>; fn insert( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>; fn append( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>; fn delete_current(&mut self) -> Result<(), DatabaseError>; }
Expand description

Read write cursor over table.

Required Methods§

fn upsert( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>

Database operation that will update an existing row if a specified value already exists in a table, and insert a new row if the specified value doesn’t already exist

fn insert( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>

Database operation that will insert a row at a given key. If the key is already present, the operation will result in an error.

fn append( &mut self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>

Append value to next cursor item.

This is efficient for pre-sorted data. If the data is not pre-sorted, use DbCursorRW::insert.

fn delete_current(&mut self) -> Result<(), DatabaseError>

Delete current value that cursor points to

Implementors§

§

impl<T> DbCursorRW<T> for CursorMock
where T: Table,

Source§

impl<T: Table> DbCursorRW<T> for Cursor<RW, T>

Available on crate feature mdbx only.