pub trait Backend: Send {
    fn as_hash_db(&self) -> &dyn HashDB<KeccakHasher, DBValue>;
fn as_hash_db_mut(&mut self) -> &mut dyn HashDB<KeccakHasher, DBValue>;
fn add_to_account_cache(
        &mut self,
        addr: Address,
        data: Option<Account>,
        modified: bool
    );
fn cache_code(&self, hash: H256, code: Arc<Vec<u8>>);
fn get_cached_account(&self, addr: &Address) -> Option<Option<Account>>;
fn get_cached<F, U>(&self, a: &Address, f: F) -> Option<U>
    where
        F: FnOnce(Option<&mut Account>) -> U
;
fn get_cached_code(&self, hash: &H256) -> Option<Arc<Vec<u8>>>; }
Expand description

State backend. See module docs for more details.

Required methods

Treat the backend as a read-only hashdb.

Treat the backend as a writeable hashdb.

t_nb 9.4 Add an account entry to the cache.

Add a global code cache entry. This doesn’t need to worry about canonicality because it simply maps hashes to raw code and will always be correct in the absence of hash collisions.

Get basic copy of the cached account. Not required to include storage. Returns ‘None’ if cache is disabled or if the account is not cached.

Get value from a cached account. None is passed to the closure if the account entry cached is known not to exist. None is returned if the entry is not cached.

Get cached code based on hash.

Implementors