Struct journaldb::overlaydb::OverlayDB [−][src]
pub struct OverlayDB { /* fields omitted */ }Implementation of the HashDB trait for a disk-backed database with a memory overlay.
The operations insert() and remove() take place on the memory overlay; batches of
such operations may be flushed to the disk-backed DB with commit() or discarded with
revert().
lookup() and contains() maintain normal behaviour - all insert() and remove()
queries have an immediate effect in terms of these functions.
Methods
impl OverlayDB[src]
impl OverlayDBpub fn new(backing: Arc<KeyValueDB>, col: Option<u32>) -> OverlayDB[src]
pub fn new(backing: Arc<KeyValueDB>, col: Option<u32>) -> OverlayDBCreate a new instance of OverlayDB given a backing database.
pub fn commit_to_batch(&mut self, batch: &mut DBTransaction) -> Result<u32>[src]
pub fn commit_to_batch(&mut self, batch: &mut DBTransaction) -> Result<u32>Commit all operations to given batch.
pub fn revert(&mut self)[src]
pub fn revert(&mut self)Revert all operations on this object (i.e. insert()s and remove()s) since the
last commit().
pub fn commit_refs(&self, key: &H256) -> i32[src]
pub fn commit_refs(&self, key: &H256) -> i32Get the number of references that would be committed.
Trait Implementations
impl AsHashDB<KeccakHasher> for OverlayDB[src]
impl AsHashDB<KeccakHasher> for OverlayDBfn as_hashdb(&self) -> &HashDB<KeccakHasher>[src]
fn as_hashdb(&self) -> &HashDB<KeccakHasher>Perform upcast to HashDB for anything that derives from HashDB.
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher>[src]
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher>Perform mutable upcast to HashDB for anything that derives from HashDB.
impl Clone for OverlayDB[src]
impl Clone for OverlayDBfn clone(&self) -> OverlayDB[src]
fn clone(&self) -> OverlayDBReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl HashDB<KeccakHasher> for OverlayDB[src]
impl HashDB<KeccakHasher> for OverlayDBfn keys(&self) -> HashMap<H256, i32>[src]
fn keys(&self) -> HashMap<H256, i32>Get the keys in the database together with number of underlying references.
fn get(&self, key: &H256) -> Option<DBValue>[src]
fn get(&self, key: &H256) -> Option<DBValue>Look up a given hash into the bytes that hash to it, returning None if the hash is not known. Read more
fn contains(&self, key: &H256) -> bool[src]
fn contains(&self, key: &H256) -> boolCheck for the existance of a hash-key.
fn insert(&mut self, value: &[u8]) -> H256[src]
fn insert(&mut self, value: &[u8]) -> H256Insert a datum item into the DB and return the datum's hash for a later lookup. Insertions are counted and the equivalent number of remove()s must be performed before the data is considered dead. Read more
fn emplace(&mut self, key: H256, value: DBValue)[src]
fn emplace(&mut self, key: H256, value: DBValue)Like insert(), except you provide the key and the data is all moved.
fn remove(&mut self, key: &H256)[src]
fn remove(&mut self, key: &H256)Remove a datum previously inserted. Insertions can be "owed" such that the same number of insert()s may happen without the data being eventually being inserted into the DB. It can be "owed" more than once. Read more