[−][src]Struct sp_database::MemDb
This implements Database
as an in-memory hash map. commit
is not atomic.
Implementations
impl<H> MemDb<H> where
H: Clone + Send + Sync + Eq + PartialEq + Default + Hash,
[src]
H: Clone + Send + Sync + Eq + PartialEq + Default + Hash,
pub fn new() -> Self
[src]
Create a new instance
pub fn count(&self, col: ColumnId) -> usize
[src]
Count number of values in a column
Trait Implementations
impl<H> Database<H> for MemDb<H> where
H: Clone + Send + Sync + Eq + PartialEq + Default + Hash,
[src]
H: Clone + Send + Sync + Eq + PartialEq + Default + Hash,
pub fn commit(&self, transaction: Transaction<H>) -> Result<()>
[src]
pub fn get(&self, col: ColumnId, key: &[u8]) -> Option<Vec<u8>>
[src]
pub fn lookup(&self, hash: &H) -> Option<Vec<u8>>
[src]
pub fn commit_ref<'a>(
&self,
transaction: &mut dyn Iterator<Item = ChangeRef<'a, H>>
) -> Result<()>
[src]
&self,
transaction: &mut dyn Iterator<Item = ChangeRef<'a, H>>
) -> Result<()>
pub fn with_get(&self, col: ColumnId, key: &[u8], f: &mut dyn FnMut(&[u8]))
[src]
pub fn set(&self, col: ColumnId, key: &[u8], value: &[u8]) -> Result<()>
[src]
pub fn remove(&self, col: ColumnId, key: &[u8]) -> Result<()>
[src]
pub fn with_lookup(&self, hash: &H, f: &mut dyn FnMut(&[u8]))
[src]
pub fn store(&self, hash: &H, preimage: &[u8]) -> Result<()>
[src]
pub fn release(&self, hash: &H) -> Result<()>
[src]
impl<H: Default + Clone + Send + Sync + Eq + PartialEq + Hash> Default for MemDb<H>
[src]
Auto Trait Implementations
impl<H> !RefUnwindSafe for MemDb<H>
[src]
impl<H> Send for MemDb<H>
[src]
impl<H> Sync for MemDb<H>
[src]
impl<H> Unpin for MemDb<H> where
H: Unpin,
[src]
H: Unpin,
impl<H> UnwindSafe for MemDb<H> where
H: UnwindSafe,
[src]
H: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,