Trait pastebin::DbInterface
[−]
[src]
pub trait DbInterface: Send + Sync { fn store_data(&self, id: ObjectId, data: &[u8]) -> Result<(), DbError>; fn load_data(&self, id: ObjectId) -> Result<Option<Vec<u8>>, DbError>; fn remove_data(&self, id: ObjectId) -> Result<(), DbError>; fn max_data_size(&self) -> usize; }
Interface to a database.
Required Methods
fn store_data(&self, id: ObjectId, data: &[u8]) -> Result<(), DbError>
Stores the data into the database.
fn load_data(&self, id: ObjectId) -> Result<Option<Vec<u8>>, DbError>
Loads data from the database.
Returns a corresponding data if found, None
otherwise.
fn remove_data(&self, id: ObjectId) -> Result<(), DbError>
Removes data from the database.
Returns None
if a corresponding data is not found, Ok(())
otherwise.
fn max_data_size(&self) -> usize
Tells the maximum data size that could be handled.