[][src]Struct tari_storage::LMDBWrapper

pub struct LMDBWrapper<K, V> { /* fields omitted */ }

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]

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]

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]

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.

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]

impl<K, V> Sync for LMDBWrapper<K, V> where
    K: Sync,
    V: Sync
[src]

impl<K, V> Unpin for LMDBWrapper<K, V> where
    K: Unpin,
    V: Unpin
[src]

impl<K, V> !UnwindSafe for LMDBWrapper<K, V>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SafeBorrow<T> for T where
    T: ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,