anvil::eth::backend::db

Trait MaybeFullDatabase

Source
pub trait MaybeFullDatabase: DatabaseRef<Error = DatabaseError> {
    // Required methods
    fn as_dyn(&self) -> &dyn DatabaseRef<Error = DatabaseError>;
    fn clear_into_state_snapshot(&mut self) -> StateSnapshot;
    fn read_as_state_snapshot(&self) -> StateSnapshot;
    fn clear(&mut self);
    fn init_from_state_snapshot(&mut self, state_snapshot: StateSnapshot);

    // Provided method
    fn maybe_as_full_db(&self) -> Option<&HashMap<Address, DbAccount>> { ... }
}
Expand description

Helper trait get access to the full state data of the database

Required Methods§

Source

fn as_dyn(&self) -> &dyn DatabaseRef<Error = DatabaseError>

Returns a reference to the database as a dyn DatabaseRef.

Source

fn clear_into_state_snapshot(&mut self) -> StateSnapshot

Clear the state and move it into a new StateSnapshot.

Source

fn read_as_state_snapshot(&self) -> StateSnapshot

Read the state snapshot.

This clones all the states and returns a new StateSnapshot.

Source

fn clear(&mut self)

Clears the entire database

Source

fn init_from_state_snapshot(&mut self, state_snapshot: StateSnapshot)

Reverses clear_into_snapshot by initializing the db’s state with the state snapshot.

Provided Methods§

Source

fn maybe_as_full_db(&self) -> Option<&HashMap<Address, DbAccount>>

Implementations on Foreign Types§

Source§

impl MaybeFullDatabase for ForkDbStateSnapshot

Source§

fn as_dyn(&self) -> &dyn DatabaseRef<Error = DatabaseError>

Source§

fn clear_into_state_snapshot(&mut self) -> StateSnapshot

Source§

fn read_as_state_snapshot(&self) -> StateSnapshot

Source§

fn clear(&mut self)

Source§

fn init_from_state_snapshot(&mut self, state_snapshot: StateSnapshot)

Source§

impl<'a, T: 'a + MaybeFullDatabase + ?Sized> MaybeFullDatabase for &'a T
where &'a T: DatabaseRef<Error = DatabaseError>,

Source§

fn as_dyn(&self) -> &dyn DatabaseRef<Error = DatabaseError>

Source§

fn maybe_as_full_db(&self) -> Option<&HashMap<Address, DbAccount>>

Source§

fn clear_into_state_snapshot(&mut self) -> StateSnapshot

Source§

fn read_as_state_snapshot(&self) -> StateSnapshot

Source§

fn clear(&mut self)

Source§

fn init_from_state_snapshot(&mut self, _state_snapshot: StateSnapshot)

Source§

impl<T: DatabaseRef<Error = DatabaseError>> MaybeFullDatabase for CacheDB<T>

Source§

fn as_dyn(&self) -> &dyn DatabaseRef<Error = DatabaseError>

Source§

fn maybe_as_full_db(&self) -> Option<&HashMap<Address, DbAccount>>

Source§

fn clear_into_state_snapshot(&mut self) -> StateSnapshot

Source§

fn read_as_state_snapshot(&self) -> StateSnapshot

Source§

fn clear(&mut self)

Source§

fn init_from_state_snapshot(&mut self, state_snapshot: StateSnapshot)

Implementors§