Trait ethcore_db::Readable
source · [−]pub trait Readable {
fn read<T, R>(
&self,
col: Option<u32>,
key: &dyn Key<T, Target = R>
) -> Option<T>
where
T: Decodable,
R: AsRef<[u8]>;
fn exists<T, R>(
&self,
col: Option<u32>,
key: &dyn Key<T, Target = R>
) -> bool
where
R: AsRef<[u8]>;
fn read_with_cache<K, T, C>(
&self,
col: Option<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: Option<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: Option<u32>,
cache: &RwLock<C>,
key: &K
) -> bool
where
K: Eq + Hash + Key<T, Target = R>,
R: AsRef<[u8]>,
C: Cache<K, T>,
{ ... }
}
Expand description
Should be used to read values from database.
Required methods
Returns value for given key.
Provided methods
Returns value for given key either in cache or in database.
Returns value for given key either in two-layered cache or in database.