Trait ethcore::db::Readable [−][src]
pub trait Readable { fn read<T, R>(
&self,
col: Option<u32>,
key: &Key<T, Target = R>
) -> Option<T>
where
T: Decodable,
R: Deref<Target = [u8]>; fn exists<T, R>(&self, col: Option<u32>, key: &Key<T, Target = R>) -> bool
where
R: Deref<Target = [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 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: Deref<Target = [u8]>,
C: Cache<K, T>, { ... } }
Should be used to read values from database.
Required Methods
fn read<T, R>(&self, col: Option<u32>, key: &Key<T, Target = R>) -> Option<T> where
T: Decodable,
R: Deref<Target = [u8]>,
T: Decodable,
R: Deref<Target = [u8]>,
Returns value for given key.
fn exists<T, R>(&self, col: Option<u32>, key: &Key<T, Target = R>) -> bool where
R: Deref<Target = [u8]>,
R: Deref<Target = [u8]>,
Returns true if given value exists.
Provided Methods
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>,
&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>,
Returns value for given key either in cache or in database.
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: Deref<Target = [u8]>,
C: Cache<K, T>,
&self,
col: Option<u32>,
cache: &RwLock<C>,
key: &K
) -> bool where
K: Eq + Hash + Key<T, Target = R>,
R: Deref<Target = [u8]>,
C: Cache<K, T>,
Returns true if given value exists either in cache or in database.
Implementors
impl<KVDB: KeyValueDB + ?Sized> Readable for KVDB