Trait Database
Source pub trait Database: Send + Sync {
// Required methods
fn get(
&self,
category: Option<DataCategory>,
key: &[u8],
) -> Result<Option<Vec<u8>>>;
fn get_batch(
&self,
category: Option<DataCategory>,
keys: &[Vec<u8>],
) -> Result<Vec<Option<Vec<u8>>>>;
fn insert(
&self,
category: Option<DataCategory>,
key: Vec<u8>,
value: Vec<u8>,
) -> Result<()>;
fn insert_batch(
&self,
category: Option<DataCategory>,
keys: Vec<Vec<u8>>,
values: Vec<Vec<u8>>,
) -> Result<()>;
fn contains(
&self,
category: Option<DataCategory>,
key: &[u8],
) -> Result<bool>;
fn remove(&self, category: Option<DataCategory>, key: &[u8]) -> Result<()>;
fn remove_batch(
&self,
category: Option<DataCategory>,
keys: &[Vec<u8>],
) -> Result<()>;
fn restore(&mut self, new_db: &str) -> Result<()>;
fn iterator(&self, category: Option<DataCategory>) -> Option<DBIterator<'_>>;
fn close(&mut self);
fn flush(&self) -> Result<()>;
}