imag/libimagstore/src/store.rs

26 lines
618 B
Rust
Raw Normal View History

2016-01-13 20:47:23 +00:00
use std::collections::HashMap;
use std::fs::File;
2016-01-13 20:51:40 +00:00
use std::ops::Drop;
2016-01-12 17:52:03 +00:00
use std::path::PathBuf;
use std::result::Result as RResult;
use std::sync::Arc;
2016-01-13 21:03:53 +00:00
use std::sync::RwLock;
2016-01-12 17:52:03 +00:00
pub use entry::Entry;
pub use error::StoreError;
pub type Result<T> = RResult<T, StoreError>;
2016-01-13 21:03:53 +00:00
pub trait Store {
2016-01-13 20:47:23 +00:00
2016-01-13 21:03:53 +00:00
fn location(&self) -> &PathBuf;
2016-01-13 20:51:40 +00:00
2016-01-13 21:03:53 +00:00
fn create(&self, entry: Entry) -> Result<()>;
fn read(&self, path: PathBuf) -> Result<Arc<RwLock<Entry>>>;
fn update(&self, entry: Arc<RwLock<Entry>>) -> Result<()>;
2016-01-16 14:11:20 +00:00
fn retrieve_copy(&self, id : String) -> Result<Entry>;
2016-01-13 21:03:53 +00:00
fn delete(&self, path: PathBuf) -> Result<()>;
2016-01-13 20:51:40 +00:00
}