Trait vapcore_db::Readable[][src]

pub trait Readable {
    fn read<T, R>(&self, col: u32, key: &dyn Key<T, Target = R>) -> Option<T>
    where
        T: Decodable,
        R: AsRef<[u8]>
;
fn exists<T, R>(&self, col: u32, key: &dyn Key<T, Target = R>) -> bool
    where
        R: AsRef<[u8]>
; fn read_with_cache<K, T, C>(
        &self,
        col: u32,
        cache: &RwLock<C>,
        key: &K
    ) -> Option<T>
    where
        K: Key<T> + Eq + Hash + Clone,
        T: Clone + Decodable,
        C: Cache<K, T>
, { ... }
fn read_with_two_layer_cache<K, T, C>(
        &self,
        col: u32,
        l1_cache: &RwLock<C>,
        l2_cache: &RwLock<C>,
        key: &K
    ) -> Option<T>
    where
        K: Key<T> + Eq + Hash + Clone,
        T: Clone + Decodable,
        C: Cache<K, T>
, { ... }
fn exists_with_cache<K, T, R, C>(
        &self,
        col: u32,
        cache: &RwLock<C>,
        key: &K
    ) -> bool
    where
        K: Eq + Hash + Key<T, Target = R>,
        R: AsRef<[u8]>,
        C: Cache<K, T>
, { ... } }

Should be used to read values from database.

Required methods

fn read<T, R>(&self, col: u32, key: &dyn Key<T, Target = R>) -> Option<T> where
    T: Decodable,
    R: AsRef<[u8]>, 
[src]

Returns value for given key.

fn exists<T, R>(&self, col: u32, key: &dyn Key<T, Target = R>) -> bool where
    R: AsRef<[u8]>, 
[src]

Returns true if given value exists.

Loading content...

Provided methods

fn read_with_cache<K, T, C>(
    &self,
    col: u32,
    cache: &RwLock<C>,
    key: &K
) -> Option<T> where
    K: Key<T> + Eq + Hash + Clone,
    T: Clone + Decodable,
    C: Cache<K, T>, 
[src]

Returns value for given key either in cache or in database.

fn read_with_two_layer_cache<K, T, C>(
    &self,
    col: u32,
    l1_cache: &RwLock<C>,
    l2_cache: &RwLock<C>,
    key: &K
) -> Option<T> where
    K: Key<T> + Eq + Hash + Clone,
    T: Clone + Decodable,
    C: Cache<K, T>, 
[src]

Returns value for given key either in two-layered cache or in database.

fn exists_with_cache<K, T, R, C>(
    &self,
    col: u32,
    cache: &RwLock<C>,
    key: &K
) -> bool where
    K: Eq + Hash + Key<T, Target = R>,
    R: AsRef<[u8]>,
    C: Cache<K, T>, 
[src]

Returns true if given value exists either in cache or in database.

Loading content...

Implementors

impl<KVDB: KeyValueDB + ?Sized> Readable for KVDB[src]

Loading content...