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
sourceimpl<H> Database<H> for MemDbwhere
H: Clone + AsRef<[u8]>,
impl<H> Database<H> for MemDbwhere
H: Clone + AsRef<[u8]>,
sourcefn 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 moresourcefn 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 moresourcefn 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.
sourcefn 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.
sourcefn supports_ref_counting(&self) -> bool
fn supports_ref_counting(&self) -> bool
Check if database supports internal ref counting for state data. Read more
sourcefn sanitize_key(&self, _key: &mut Vec<u8>)
fn sanitize_key(&self, _key: &mut Vec<u8>)
Remove a possible path-prefix from the key. 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more