diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-08-26 12:52:57 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-08-28 18:41:56 +0200 |
commit | 372d46d2aa5c9cb5d429d8389fc037f0ccd9f243 (patch) | |
tree | 88295464aa9c905d81966c43fe73cc717ce7affc /imag-store/src | |
parent | fedb75ec988062f23fb9d686980661bbf8d76028 (diff) |
Fix imag-store::{create, delete, get, retrieve, update}::* for new StoreId interface
Diffstat (limited to 'imag-store/src')
-rw-r--r-- | imag-store/src/create.rs | 9 | ||||
-rw-r--r-- | imag-store/src/delete.rs | 7 | ||||
-rw-r--r-- | imag-store/src/get.rs | 7 | ||||
-rw-r--r-- | imag-store/src/retrieve.rs | 7 | ||||
-rw-r--r-- | imag-store/src/update.rs | 6 |
5 files changed, 21 insertions, 15 deletions
diff --git a/imag-store/src/create.rs b/imag-store/src/create.rs index 7329df3f..93a58828 100644 --- a/imag-store/src/create.rs +++ b/imag-store/src/create.rs @@ -13,8 +13,6 @@ use clap::ArgMatches; use libimagrt::runtime::Runtime; use libimagstore::store::Entry; use libimagstore::store::EntryHeader; -use libimagstore::storeid::build_entry_path; -use libimagerror::trace::trace_error_exit; use error::StoreError; use error::StoreErrorKind; @@ -36,10 +34,7 @@ pub fn create(rt: &Runtime) { exit(1); } - let path = match build_entry_path(rt.store(), path.unwrap()) { - Err(e) => trace_error_exit(&e, 1), - Ok(p) => p, - }; + let path = PathBuf::from(path.unwrap()); debug!("path = {:?}", path); if scmd.subcommand_matches("entry").is_some() { @@ -111,7 +106,7 @@ fn create_with_content_and_header(rt: &Runtime, content: String, header: EntryHeader) -> Result<()> { - debug!("Creating entry with content"); + debug!("Creating entry with content at {:?}", path); rt.store() .create(PathBuf::from(path)) .map(|mut element| { diff --git a/imag-store/src/delete.rs b/imag-store/src/delete.rs index 46626816..537b638d 100644 --- a/imag-store/src/delete.rs +++ b/imag-store/src/delete.rs @@ -1,6 +1,8 @@ -use libimagstore::storeid::build_entry_path; +use std::path::PathBuf; + use libimagrt::runtime::Runtime; use libimagerror::trace::trace_error_exit; +use libimagstore::storeid::StoreId; pub fn delete(rt: &Runtime) { use std::process::exit; @@ -10,7 +12,8 @@ pub fn delete(rt: &Runtime) { .map(|sub| { sub.value_of("id") .map(|id| { - let path = try!(build_entry_path(rt.store(), id) + let path = PathBuf::from(id); + let path = try!(StoreId::new(Some(rt.store().path().clone()), path) .map_err(|e| trace_error_exit(&e, 1))); debug!("Deleting file at {:?}", id); diff --git a/imag-store/src/get.rs b/imag-store/src/get.rs index 3e33ac2b..1302b763 100644 --- a/imag-store/src/get.rs +++ b/imag-store/src/get.rs @@ -1,6 +1,8 @@ -use libimagstore::storeid::build_entry_path; +use std::path::PathBuf; + use libimagrt::runtime::Runtime; use libimagerror::trace::{trace_error, trace_error_exit}; +use libimagstore::storeid::StoreId; use retrieve::print_entry; @@ -10,7 +12,8 @@ pub fn get(rt: &Runtime) { .map(|scmd| { scmd.value_of("id") .map(|id| { - let path = match build_entry_path(rt.store(), id) { + let path = PathBuf::from(id); + let path = match StoreId::new(Some(rt.store().path().clone()), path) { Err(e) => trace_error_exit(&e, 1), Ok(p) => p, }; diff --git a/imag-store/src/retrieve.rs b/imag-store/src/retrieve.rs index f9f45993..39b66741 100644 --- a/imag-store/src/retrieve.rs +++ b/imag-store/src/retrieve.rs @@ -1,8 +1,10 @@ +use std::path::PathBuf; + use clap::ArgMatches; use toml::Value; use libimagstore::store::FileLockEntry; -use libimagstore::storeid::build_entry_path; +use libimagstore::storeid::StoreId; use libimagrt::runtime::Runtime; use libimagerror::trace::{trace_error, trace_error_exit}; @@ -12,7 +14,8 @@ pub fn retrieve(rt: &Runtime) { .map(|scmd| { scmd.value_of("id") .map(|id| { - let path = try!(build_entry_path(rt.store(), id) + let path = PathBuf::from(id); + let path = try!(StoreId::new(Some(rt.store().path().clone()), path) .map_err(|e| trace_error_exit(&e, 1))); debug!("path = {:?}", path); diff --git a/imag-store/src/update.rs b/imag-store/src/update.rs index 9959ec09..87279dc0 100644 --- a/imag-store/src/update.rs +++ b/imag-store/src/update.rs @@ -1,8 +1,9 @@ use std::ops::DerefMut; +use std::path::PathBuf; use libimagrt::runtime::Runtime; -use libimagstore::storeid::build_entry_path; use libimagerror::trace::trace_error_exit; +use libimagstore::storeid::StoreId; use util::build_toml_header; @@ -12,7 +13,8 @@ pub fn update(rt: &Runtime) { .map(|scmd| { scmd.value_of("id") .map(|id| { - let path = match build_entry_path(rt.store(), id) { + let path = PathBuf::from(id); + let path = match StoreId::new(Some(rt.store().path().clone()), path) { Err(e) => trace_error_exit(&e, 1), Ok(p) => p, }; |