Merge branch 'neithernut/init-libstore-alt' into add-libstore
This commit is contained in:
commit
9d7f20b68e
4 changed files with 58 additions and 0 deletions
51
Cargo.lock
generated
51
Cargo.lock
generated
|
@ -8,6 +8,30 @@ dependencies = [
|
||||||
"libimagutil 0.1.0",
|
"libimagutil 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fs2"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kernel32-sys"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libimagmodule"
|
name = "libimagmodule"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -19,8 +43,35 @@ version = "0.1.0"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libimagstore"
|
name = "libimagstore"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"fs2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"toml 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libimagutil"
|
name = "libimagutil"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc-serialize"
|
||||||
|
version = "0.3.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.1.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.2.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-build"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
|
|
@ -6,5 +6,6 @@ pub mod entry;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod fsstore;
|
pub mod fsstore;
|
||||||
pub mod header;
|
pub mod header;
|
||||||
|
pub mod single_use_lock;
|
||||||
pub mod store;
|
pub mod store;
|
||||||
|
|
||||||
|
|
5
libimagstore/src/single_use_lock.rs
Normal file
5
libimagstore/src/single_use_lock.rs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
pub trait SingleUseLock<T> {
|
||||||
|
fn access(&self) -> &T;
|
||||||
|
fn unlock(self) -> T;
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ pub trait Store {
|
||||||
fn create(&self, entry: Entry) -> Result<()>;
|
fn create(&self, entry: Entry) -> Result<()>;
|
||||||
fn read(&self, path: PathBuf) -> Result<Arc<RwLock<Entry>>>;
|
fn read(&self, path: PathBuf) -> Result<Arc<RwLock<Entry>>>;
|
||||||
fn update(&self, entry: Arc<RwLock<Entry>>) -> Result<()>;
|
fn update(&self, entry: Arc<RwLock<Entry>>) -> Result<()>;
|
||||||
|
fn retrieve_copy(&self, id : String) -> Result<Entry>;
|
||||||
fn delete(&self, path: PathBuf) -> Result<()>;
|
fn delete(&self, path: PathBuf) -> Result<()>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue