Trait ethcore::state::backend::Backend
[−]
[src]
pub trait Backend: Send { fn as_hashdb(&self) -> &HashDB; fn as_hashdb_mut(&mut self) -> &mut HashDB; 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>>>; fn note_non_null_account(&self, address: &Address); fn is_known_null(&self, address: &Address) -> bool; }
State backend. See module docs for more details.
Required Methods
fn as_hashdb(&self) -> &HashDB
Treat the backend as a read-only hashdb.
fn as_hashdb_mut(&mut self) -> &mut HashDB
Treat the backend as a writeable hashdb.
fn add_to_account_cache(
&mut self,
addr: Address,
data: Option<Account>,
modified: bool
)
&mut self,
addr: Address,
data: Option<Account>,
modified: bool
)
Add an account entry to the cache.
fn cache_code(&self, hash: H256, code: Arc<Vec<u8>>)
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.
fn get_cached_account(&self, addr: &Address) -> Option<Option<Account>>
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.
fn get_cached<F, U>(&self, a: &Address, f: F) -> Option<U> where
F: FnOnce(Option<&mut Account>) -> U,
F: FnOnce(Option<&mut Account>) -> U,
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.
fn get_cached_code(&self, hash: &H256) -> Option<Arc<Vec<u8>>>
Get cached code based on hash.
fn note_non_null_account(&self, address: &Address)
Note that an account with the given address is non-null.
fn is_known_null(&self, address: &Address) -> bool
Check whether an account is known to be empty. Returns true if known to be empty, false otherwise.