Struct sp_database::MemDb
source · pub struct MemDb(/* private fields */);
Expand description
This implements Database
as an in-memory hash map. commit
is not atomic.
Implementations§
Trait Implementations§
source§impl<H> Database<H> for MemDb
impl<H> Database<H> for MemDb
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.source§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.source§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
Auto Trait Implementations§
impl !RefUnwindSafe for MemDb
impl Send for MemDb
impl Sync for MemDb
impl Unpin for MemDb
impl UnwindSafe for MemDb
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more