Add initial version of store interface

The interface enables users to both create and remove entries. It also
features methods for retrieval of both unlocked and lockes entries and a
method for writing back the latter one only.
This commit is contained in:
Julian Ganz 2016-01-16 07:15:49 +01:00
parent 6c2962efe9
commit a7d1cdadc0

17
libimagstore/src/store.rs Normal file
View file

@ -0,0 +1,17 @@
use std::result::Result as RResult;
use std::string;
pub use entry::Entry;
pub use error::StoreError;
pub type Result<T> = RResult<T, StoreError>;
pub type LockedEntry = SingleUseLock<Entry>;
pub trait Store {
fn create(&self, entry : Entry) -> Result<()>;
fn retrieve(&self, id : string) -> Result<LockedEntry>;
fn retrieve_copy(&self, id : string) -> Result<Entry>;
fn update(&self, LockedEntry) -> Result<()>;
fn delete(&self, id : string) -> Result<()>;
}