Skip to main content

DynDatabase

Trait DynDatabase 

pub trait DynDatabase: NonStaticAny {
    // Required methods
    fn get_account(
        &mut self,
        address: &Address,
    ) -> Result<Option<AccountInfo>, DatabaseError>;
    fn get_code_by_hash(
        &mut self,
        code_hash: &FixedBytes<32>,
    ) -> Result<Bytecode, DatabaseError>;
    fn get_storage(
        &mut self,
        address: &Address,
        key: &Uint<256, 4>,
    ) -> Result<Uint<256, 4>, DatabaseError>;
    fn get_block_hash(
        &mut self,
        number: &Uint<256, 4>,
    ) -> Result<FixedBytes<32>, DatabaseError>;
}
Expand description

Backing database view used to initialize mutable [super::State].

Required Methods§

fn get_account( &mut self, address: &Address, ) -> Result<Option<AccountInfo>, DatabaseError>

Loads account information.

fn get_code_by_hash( &mut self, code_hash: &FixedBytes<32>, ) -> Result<Bytecode, DatabaseError>

Loads bytecode by code hash.

fn get_storage( &mut self, address: &Address, key: &Uint<256, 4>, ) -> Result<Uint<256, 4>, DatabaseError>

Loads a persistent storage slot.

fn get_block_hash( &mut self, number: &Uint<256, 4>, ) -> Result<FixedBytes<32>, DatabaseError>

Loads a historical block hash.

Callers only request numbers inside the BLOCKHASH window, so a hash the database cannot provide is a database failure reported through the error, never a benign miss.

Trait Implementations§

§

impl<'a> Deref for dyn DynDatabase + 'a

§

type Target = dyn NonStaticAny + 'a

The resulting type after dereferencing.
§

fn deref(&self) -> &<dyn DynDatabase + 'a as Deref>::Target

Dereferences the value.
§

impl<'a> DerefMut for dyn DynDatabase + 'a

§

fn deref_mut(&mut self) -> &mut <dyn DynDatabase + 'a as Deref>::Target

Mutably dereferences the value.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

§

impl<'a, T> DynDatabase for &'a mut T
where T: 'a + DynDatabase + ?Sized, &'a mut T: NonStaticAny,

§

fn get_account( &mut self, address: &Address, ) -> Result<Option<AccountInfo>, DatabaseError>

§

fn get_code_by_hash( &mut self, code_hash: &FixedBytes<32>, ) -> Result<Bytecode, DatabaseError>

§

fn get_storage( &mut self, address: &Address, key: &Uint<256, 4>, ) -> Result<Uint<256, 4>, DatabaseError>

§

fn get_block_hash( &mut self, number: &Uint<256, 4>, ) -> Result<FixedBytes<32>, DatabaseError>

§

impl<T> DynDatabase for Box<T>
where T: DynDatabase + ?Sized, Box<T>: NonStaticAny,

§

fn get_account( &mut self, address: &Address, ) -> Result<Option<AccountInfo>, DatabaseError>

§

fn get_code_by_hash( &mut self, code_hash: &FixedBytes<32>, ) -> Result<Bytecode, DatabaseError>

§

fn get_storage( &mut self, address: &Address, key: &Uint<256, 4>, ) -> Result<Uint<256, 4>, DatabaseError>

§

fn get_block_hash( &mut self, number: &Uint<256, 4>, ) -> Result<FixedBytes<32>, DatabaseError>

Implementors§

§

impl DynDatabase for EmptyDB

§

impl<D> DynDatabase for DbStats<D>
where D: DynDatabase,

§

impl<ExtDB> DynDatabase for CacheDB<ExtDB>
where ExtDB: DynDatabase,

§

impl<T> DynDatabase for Db<T>
where T: Database,

§

impl<T> DynDatabase for DbRef<T>
where T: DatabaseRef,