Struct sp_database::MemDb
source · pub struct MemDb(_);
Expand description
This implements Database
as an in-memory hash map. commit
is not atomic.
Implementations§
Trait Implementations§
source§impl<H> Database<H> for MemDbwhere
H: Clone + AsRef<[u8]>,
impl<H> Database<H> for MemDbwhere
H: Clone + AsRef<[u8]>,
source§fn commit(&self, transaction: Transaction<H>) -> Result<()>
fn commit(&self, transaction: Transaction<H>) -> Result<()>
Commit the
transaction
to the database atomically. Any further calls to get
or lookup
will reflect the new state. Read moresource§fn get(&self, col: ColumnId, key: &[u8]) -> Option<Vec<u8>>
fn get(&self, col: ColumnId, key: &[u8]) -> Option<Vec<u8>>
Retrieve the value previously stored against
key
or None
if
key
is not currently in the database. Read moresource§fn contains(&self, col: ColumnId, key: &[u8]) -> bool
fn contains(&self, col: ColumnId, key: &[u8]) -> bool
Check if the value exists in the database without retrieving it.
source§fn value_size(&self, col: ColumnId, key: &[u8]) -> Option<usize>
fn value_size(&self, col: ColumnId, key: &[u8]) -> Option<usize>
Check value size in the database possibly without retrieving it.
source§fn supports_ref_counting(&self) -> bool
fn supports_ref_counting(&self) -> bool
Check if database supports internal ref counting for state data. Read more