pub trait Store {
// Required methods
fn read<K>(&self, key: K) -> Result<Option<Vec<u8>>, Error>
where K: AsRef<[u8]>;
fn write<K, V>(&self, key: K, value: V) -> Result<(), Error>
where K: AsRef<[u8]>,
V: AsRef<[u8]>;
fn delete<K>(&self, key: K) -> Result<(), Error>
where K: AsRef<[u8]>;
fn exists<K>(&self, key: K) -> Result<bool, Error>
where K: AsRef<[u8]>;
// Provided methods
fn bulk_read<K>(&self, keys: &[K]) -> Result<Vec<Option<Vec<u8>>>, Error>
where K: AsRef<[u8]> { ... }
fn bulk_write<K, V>(&self, values: &[(K, V)]) -> Result<(), Error>
where K: AsRef<[u8]>,
V: AsRef<[u8]> { ... }
fn bulk_delete<K>(&self, keys: &[K]) -> Result<(), Error>
where K: AsRef<[u8]> { ... }
}
Expand description
Store interface used as a KV store implementation
Required Methods§
Sourcefn read<K>(&self, key: K) -> Result<Option<Vec<u8>>, Error>
fn read<K>(&self, key: K) -> Result<Option<Vec<u8>>, Error>
Read single value from data store and return None
if key doesn’t exist.
Provided Methods§
Sourcefn bulk_read<K>(&self, keys: &[K]) -> Result<Vec<Option<Vec<u8>>>, Error>
fn bulk_read<K>(&self, keys: &[K]) -> Result<Vec<Option<Vec<u8>>>, Error>
Read slice of keys and return a vector of optional values.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.