Struct kvdb_memorydb::InMemory
source · pub struct InMemory { /* private fields */ }
Expand description
A key-value database fulfilling the KeyValueDB
trait, living in memory.
This is generally intended for tests and is not particularly optimized.
Trait Implementations§
source§impl KeyValueDB for InMemory
impl KeyValueDB for InMemory
source§fn get_by_prefix(&self, col: u32, prefix: &[u8]) -> Result<Option<DBValue>>
fn get_by_prefix(&self, col: u32, prefix: &[u8]) -> Result<Option<DBValue>>
Get the first value matching the given prefix.
source§fn write(&self, transaction: DBTransaction) -> Result<()>
fn write(&self, transaction: DBTransaction) -> Result<()>
Write a transaction of changes to the backing store.
source§fn iter<'a>(
&'a self,
col: u32
) -> Box<dyn Iterator<Item = Result<DBKeyValue>> + 'a>
fn iter<'a>(
&'a self,
col: u32
) -> Box<dyn Iterator<Item = Result<DBKeyValue>> + 'a>
Iterate over the data for a given column.
source§fn iter_with_prefix<'a>(
&'a self,
col: u32,
prefix: &'a [u8]
) -> Box<dyn Iterator<Item = Result<DBKeyValue>> + 'a>
fn iter_with_prefix<'a>(
&'a self,
col: u32,
prefix: &'a [u8]
) -> Box<dyn Iterator<Item = Result<DBKeyValue>> + 'a>
Iterate over the data for a given column, returning all key/value pairs
where the key starts with the given prefix. Read more
source§fn transaction(&self) -> DBTransaction
fn transaction(&self) -> DBTransaction
Helper to create a new transaction.