Struct ethcore_util::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]
fn new(backing: Arc<Database>, col: Option<u32>) -> OverlayDB
Create a new instance of OverlayDB given a backing
database.
fn commit_to_batch(&mut self,
batch: &mut DBTransaction)
-> Result<u32, UtilError>
batch: &mut DBTransaction)
-> Result<u32, UtilError>
Commit all operations to given batch.
fn revert(&mut self)
Revert all operations on this object (i.e. insert()
s and remove()
s) since the
last commit()
.
fn commit_refs(&self, key: &H256) -> i32
Get the number of references that would be committed.
Trait Implementations
impl Clone for OverlayDB
[src]
fn clone(&self) -> OverlayDB
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl HashDB for OverlayDB
[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>
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
Check for the existance of a hash-key. Read more
fn insert(&mut self, value: &[u8]) -> H256
Insert 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)
Like insert()
, except you provide the key and the data is all moved.
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. Read more