DatabaseAsync

Trait DatabaseAsync 

Source
pub trait DatabaseAsync {
    type Error: DBErrorMarker;

    // Required methods
    fn basic_async(
        &mut self,
        address: Address,
    ) -> impl Future<Output = Result<Option<AccountInfo>, Self::Error>> + Send;
    fn code_by_hash_async(
        &mut self,
        code_hash: FixedBytes<32>,
    ) -> impl Future<Output = Result<Bytecode, Self::Error>> + Send;
    fn storage_async(
        &mut self,
        address: Address,
        index: Uint<256, 4>,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send;
    fn block_hash_async(
        &mut self,
        number: u64,
    ) -> impl Future<Output = Result<FixedBytes<32>, Self::Error>> + Send;

    // Provided method
    fn storage_by_account_id_async(
        &mut self,
        address: Address,
        account_id: usize,
        storage_key: Uint<256, 4>,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send { ... }
}
Expand description

The async EVM database interface

Contains the same methods as Database, but it returns Future type instead.

Use WrapDatabaseAsync to provide Database implementation for a type that only implements this trait.

Required Associated Types§

Source

type Error: DBErrorMarker

The database error type

Required Methods§

Source

fn basic_async( &mut self, address: Address, ) -> impl Future<Output = Result<Option<AccountInfo>, Self::Error>> + Send

Gets basic account information.

Source

fn code_by_hash_async( &mut self, code_hash: FixedBytes<32>, ) -> impl Future<Output = Result<Bytecode, Self::Error>> + Send

Gets account code by its hash.

Source

fn storage_async( &mut self, address: Address, index: Uint<256, 4>, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send

Gets storage value of address at index.

Source

fn block_hash_async( &mut self, number: u64, ) -> impl Future<Output = Result<FixedBytes<32>, Self::Error>> + Send

Gets block hash by block number.

Provided Methods§

Source

fn storage_by_account_id_async( &mut self, address: Address, account_id: usize, storage_key: Uint<256, 4>, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send

Gets storage value of account by its id.

Default implementation is to call DatabaseAsync::storage_async method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§