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:
parent
6c2962efe9
commit
a7d1cdadc0
1 changed files with 17 additions and 0 deletions
17
libimagstore/src/store.rs
Normal file
17
libimagstore/src/store.rs
Normal 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<()>;
|
||||
}
|
||||
|
Loading…
Reference in a new issue