reth_trie/trie_cursor/
noop.rsuse super::{TrieCursor, TrieCursorFactory};
use crate::{BranchNodeCompact, Nibbles};
use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError;
#[derive(Default, Debug)]
#[non_exhaustive]
pub struct NoopTrieCursorFactory;
impl TrieCursorFactory for NoopTrieCursorFactory {
type AccountTrieCursor = NoopAccountTrieCursor;
type StorageTrieCursor = NoopStorageTrieCursor;
fn account_trie_cursor(&self) -> Result<Self::AccountTrieCursor, DatabaseError> {
Ok(NoopAccountTrieCursor::default())
}
fn storage_trie_cursor(
&self,
_hashed_address: B256,
) -> Result<Self::StorageTrieCursor, DatabaseError> {
Ok(NoopStorageTrieCursor::default())
}
}
#[derive(Default, Debug)]
#[non_exhaustive]
pub struct NoopAccountTrieCursor;
impl TrieCursor for NoopAccountTrieCursor {
fn seek_exact(
&mut self,
_key: Nibbles,
) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError> {
Ok(None)
}
fn seek(
&mut self,
_key: Nibbles,
) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError> {
Ok(None)
}
fn next(&mut self) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError> {
Ok(None)
}
fn current(&mut self) -> Result<Option<Nibbles>, DatabaseError> {
Ok(None)
}
}
#[derive(Default, Debug)]
#[non_exhaustive]
pub struct NoopStorageTrieCursor;
impl TrieCursor for NoopStorageTrieCursor {
fn seek_exact(
&mut self,
_key: Nibbles,
) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError> {
Ok(None)
}
fn seek(
&mut self,
_key: Nibbles,
) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError> {
Ok(None)
}
fn next(&mut self) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError> {
Ok(None)
}
fn current(&mut self) -> Result<Option<Nibbles>, DatabaseError> {
Ok(None)
}
}