Trait journaldb::JournalDB[][src]

pub trait JournalDB: HashDB<KeccakHasher> {
    fn boxed_clone(&self) -> Box<JournalDB>;
fn mem_used(&self) -> usize;
fn is_empty(&self) -> bool;
fn latest_era(&self) -> Option<u64>;
fn journal_under(
        &mut self,
        batch: &mut DBTransaction,
        now: u64,
        id: &H256
    ) -> Result<u32>;
fn mark_canonical(
        &mut self,
        batch: &mut DBTransaction,
        era: u64,
        id: &H256
    ) -> Result<u32>;
fn inject(&mut self, batch: &mut DBTransaction) -> Result<u32>;
fn state(&self, _id: &H256) -> Option<Bytes>;
fn backing(&self) -> &Arc<KeyValueDB>;
fn consolidate(&mut self, overlay: MemoryDB<KeccakHasher>); fn journal_size(&self) -> usize { ... }
fn earliest_era(&self) -> Option<u64> { ... }
fn is_pruned(&self) -> bool { ... }
fn flush(&self) { ... } }

A HashDB which can manage a short-term journal potentially containing many forks of mutually exclusive actions.

Required Methods

Return a copy of ourself, in a box.

Returns heap memory size used

Check if this database has any commits

Get the latest era in the DB. None if there isn't yet any data in there.

Journal recent database operations as being associated with a given era and id.

Mark a given block as canonical, indicating that competing blocks' states may be pruned out.

Commit all queued insert and delete operations without affecting any journalling -- this requires that all insertions and deletions are indeed canonical and will likely lead to an invalid database if that assumption is violated.

Any keys or values inserted or deleted must be completely independent of those affected by any previous commit operations. Essentially, this means that inject can be used either to restore a state to a fresh database, or to insert data which may only be journalled from this point onwards.

State data query

Get backing database.

Consolidate all the insertions and deletions in the given memory overlay.

Provided Methods

Returns the size of journalled state in memory. This function has a considerable speed requirement -- it must be fast enough to call several times per block imported.

Get the earliest era in the DB. None if there isn't yet any data in there.

Whether this database is pruned.

Clear internal strucutres. This should called after changes have been written to the backing strage

Implementors