[−][src]Struct tari_storage::LMDBWrapper
This is a simple wrapper struct that lifts the generic parameters so that KeyValStore can be implemented on LMDBDatabase. LMDBDatabase doesn't have the generics at the struct level because the LMDBStore can contain many instances of LMDBDatabase each with different K and V types.
Implementations
impl<K, V> LMDBWrapper<K, V>
[src]
pub fn new(db: Arc<LMDBDatabase>) -> LMDBWrapper<K, V>
[src]
Wrap a LMDBDatabase instance so that it implements KeyValueStore
pub fn inner(&self) -> Arc<LMDBDatabase>
[src]
Get access to the underlying LMDB database
Trait Implementations
impl<K, V> KeyValueStore<K, V> for LMDBWrapper<K, V> where
K: AsLmdbBytes + DeserializeOwned,
V: Serialize + DeserializeOwned,
[src]
K: AsLmdbBytes + DeserializeOwned,
V: Serialize + DeserializeOwned,
fn insert(&self, key: K, value: V) -> Result<(), KeyValStoreError>
[src]
Inserts a key-value pair into the key-value database.
fn get(&self, key: &K) -> Result<Option<V>, KeyValStoreError> where
V: DeserializeOwned,
[src]
V: DeserializeOwned,
Get the value corresponding to the provided key from the key-value database.
fn size(&self) -> Result<usize, KeyValStoreError>
[src]
Returns the total number of entries recorded in the key-value database.
fn for_each<F>(&self, f: F) -> Result<(), KeyValStoreError> where
F: FnMut(Result<(K, V), KeyValStoreError>) -> IterationResult,
[src]
F: FnMut(Result<(K, V), KeyValStoreError>) -> IterationResult,
Iterate over all the stored records and execute the function f
for each pair in the key-value database.
fn exists(&self, key: &K) -> Result<bool, KeyValStoreError>
[src]
Checks whether a record exist in the key-value database that corresponds to the provided key
.
fn delete(&self, key: &K) -> Result<(), KeyValStoreError>
[src]
Remove the record from the key-value database that corresponds with the provided key
.
fn for_each_ok<F>(&self, mut f: F) -> Result<(), KeyValStoreError> where
Self: Sized,
F: FnMut((K, V)) -> IterationResult,
[src]
Self: Sized,
F: FnMut((K, V)) -> IterationResult,
fn filter<F>(&self, predicate: F) -> Result<Vec<(K, V)>, KeyValStoreError> where
Self: Sized,
F: FnMut(&(K, V)) -> bool,
[src]
Self: Sized,
F: FnMut(&(K, V)) -> bool,
fn filter_take<F>(
&self,
n: usize,
mut predicate: F
) -> Result<Vec<(K, V)>, KeyValStoreError> where
Self: Sized,
F: FnMut(&(K, V)) -> bool,
[src]
&self,
n: usize,
mut predicate: F
) -> Result<Vec<(K, V)>, KeyValStoreError> where
Self: Sized,
F: FnMut(&(K, V)) -> bool,
Auto Trait Implementations
impl<K, V> !RefUnwindSafe for LMDBWrapper<K, V>
[src]
impl<K, V> Send for LMDBWrapper<K, V> where
K: Send,
V: Send,
[src]
K: Send,
V: Send,
impl<K, V> Sync for LMDBWrapper<K, V> where
K: Sync,
V: Sync,
[src]
K: Sync,
V: Sync,
impl<K, V> Unpin for LMDBWrapper<K, V> where
K: Unpin,
V: Unpin,
[src]
K: Unpin,
V: Unpin,
impl<K, V> !UnwindSafe for LMDBWrapper<K, V>
[src]
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> SafeBorrow<T> for T where
T: ?Sized,
T: ?Sized,
pub fn borrow_replacement(ptr: &T) -> &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>,
V: MultiLane<T>,