reth_trie/trie_cursor/
mod.rsuse crate::{BranchNodeCompact, Nibbles};
use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError;
mod in_memory;
mod subnode;
pub mod noop;
pub use self::{in_memory::*, subnode::CursorSubNode};
pub trait TrieCursorFactory {
type AccountTrieCursor: TrieCursor;
type StorageTrieCursor: TrieCursor;
fn account_trie_cursor(&self) -> Result<Self::AccountTrieCursor, DatabaseError>;
fn storage_trie_cursor(
&self,
hashed_address: B256,
) -> Result<Self::StorageTrieCursor, DatabaseError>;
}
#[auto_impl::auto_impl(&mut, Box)]
pub trait TrieCursor: Send + Sync {
fn seek_exact(
&mut self,
key: Nibbles,
) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError>;
fn seek(&mut self, key: Nibbles)
-> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError>;
fn next(&mut self) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError>;
fn current(&mut self) -> Result<Option<Nibbles>, DatabaseError>;
}