From a7d1cdadc03f6176df945d540aac9a49fdffc4e8 Mon Sep 17 00:00:00 2001 From: Julian Ganz Date: Sat, 16 Jan 2016 07:15:49 +0100 Subject: [PATCH] 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. --- libimagstore/src/store.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 libimagstore/src/store.rs diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs new file mode 100644 index 00000000..5dd45d9c --- /dev/null +++ b/libimagstore/src/store.rs @@ -0,0 +1,17 @@ +use std::result::Result as RResult; +use std::string; + +pub use entry::Entry; +pub use error::StoreError; + +pub type Result = RResult; +pub type LockedEntry = SingleUseLock; + +pub trait Store { + fn create(&self, entry : Entry) -> Result<()>; + fn retrieve(&self, id : string) -> Result; + fn retrieve_copy(&self, id : string) -> Result; + fn update(&self, LockedEntry) -> Result<()>; + fn delete(&self, id : string) -> Result<()>; +} +