Struct sp_database::MemDb [−][src]
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,
fn commit(&self, transaction: Transaction<H>) -> Result<()>
[src]
fn get(&self, col: ColumnId, key: &[u8]) -> Option<Vec<u8>>
[src]
fn lookup(&self, hash: &H) -> Option<Vec<u8>>
[src]
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<()>
fn with_get(&self, col: ColumnId, key: &[u8], f: &mut dyn FnMut(&[u8]))
[src]
fn set(&self, col: ColumnId, key: &[u8], value: &[u8]) -> Result<()>
[src]
fn remove(&self, col: ColumnId, key: &[u8]) -> Result<()>
[src]
fn with_lookup(&self, hash: &H, f: &mut dyn FnMut(&[u8]))
[src]
fn store(&self, hash: &H, preimage: &[u8]) -> Result<()>
[src]
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>
impl<H> Send for MemDb<H>
impl<H> Sync for MemDb<H>
impl<H> Unpin for MemDb<H> where
H: Unpin,
H: Unpin,
impl<H> UnwindSafe for MemDb<H> where
H: UnwindSafe,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,