Skip to main content

MaybeFullDatabase

Trait MaybeFullDatabase 

Source
pub trait MaybeFullDatabase: DatabaseRef<Error = DatabaseError> + Debug {
    // Required methods
    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 methods
    fn maybe_as_full_db(&self) -> Option<&AddressMap<DbAccount>> { ... }
    fn is_persistent(&self) -> bool { ... }
}
Expand description

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

Required Methods§

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<&AddressMap<DbAccount>>

Source

fn is_persistent(&self) -> bool

Returns whether snapshots of this database use structural sharing.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

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

Source§

fn maybe_as_full_db(&self) -> Option<&AddressMap<DbAccount>>

Source§

fn is_persistent(&self) -> bool

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<N: Network> MaybeFullDatabase for ForkDbStateSnapshot<N>

Source§

fn maybe_as_full_db(&self) -> Option<&AddressMap<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> + Debug> MaybeFullDatabase for CacheDB<T>

Source§

fn maybe_as_full_db(&self) -> Option<&AddressMap<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§