Struct ethcore::state_db::StateDB [] [src]

pub struct StateDB { /* fields omitted */ }

State database abstraction. Manages shared global state cache which reflects the canonical state as it is on the disk. All the entries in the cache are clean. A clone of StateDB may be created as canonical or not. For canonical clones local cache is accumulated and applied in sync_cache For non-canonical clones local cache is dropped.

Global cache propagation. After a State object has been committed to the trie it propagates its local cache into the StateDB local cache using add_to_account_cache function. Then, after the block has been added to the chain the local cache in the StateDB is propagated into the global cache.

Methods

impl StateDB
[src]

Create a new instance wrapping JournalDB and the maximum allowed size of the LRU cache in bytes. Actual used memory may (read: will) be higher due to bookkeeping.

Loads accounts bloom from the database This bloom is used to handle request for the non-existant account fast

Commit blooms journal to the database transaction

Journal all recent operations under the given era and ID.

Mark a given candidate from an ancient era as canonical, enacting its removals from the backing database and reverting any non-canonical historical commit's insertions.

Propagate local cache into the global cache and synchonize the global cache with the best block state. This function updates the global cache by removing entries that are invalidated by chain reorganization. sync_cache should be called after the block has been committed and the blockchain route has ben calculated.

Conversion method to interpret self as HashDB reference

Conversion method to interpret self as mutable HashDB reference

Clone the database.

Clone the database for a canonical state.

Check if pruning is enabled on the database.

Heap size used.

Returns underlying JournalDB.

Query how much memory is set aside for the accounts cache (in bytes).

Trait Implementations

impl Backend for StateDB
[src]

Treat the backend as a read-only hashdb.

Treat the backend as a writeable hashdb.

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. Read more

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. Read more

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. Read more

Get cached code based on hash.

Note that an account with the given address is non-null.

Check whether an account is known to be empty. Returns true if known to be empty, false otherwise. Read more

Auto Trait Implementations

impl Send for StateDB

impl Sync for StateDB