summaryrefslogtreecommitdiffstats
path: root/bin/core
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-11-02 11:08:22 +0100
committerMatthias Beyer <mail@beyermatthias.de>2018-11-06 20:35:18 +0100
commitf20298cbe8995790af138b0e231e3b4b53ede7e8 (patch)
tree3bbca99547dae2ed944190bd01931c38c452c3db /bin/core
parentc616a5cfafe9c4963b7399f75d3abb3ae152f57d (diff)
Add ID reporting in imag-store
Diffstat (limited to 'bin/core')
-rw-r--r--bin/core/imag-store/src/create.rs2
-rw-r--r--bin/core/imag-store/src/get.rs7
-rw-r--r--bin/core/imag-store/src/retrieve.rs6
-rw-r--r--bin/core/imag-store/src/update.rs20
-rw-r--r--bin/core/imag-store/src/verify.rs1
5 files changed, 24 insertions, 12 deletions
diff --git a/bin/core/imag-store/src/create.rs b/bin/core/imag-store/src/create.rs
index 6ee5ecfe..866f3aba 100644
--- a/bin/core/imag-store/src/create.rs
+++ b/bin/core/imag-store/src/create.rs
@@ -62,6 +62,8 @@ pub fn create(rt: &Runtime) {
Entry::default_header())
}
.map_err_trace_exit_unwrap(1);
+
+ let _ = rt.report_touched(&path).map_err_trace_exit_unwrap(1);
}
fn create_from_cli_spec(rt: &Runtime, matches: &ArgMatches, path: &StoreId) -> Result<()> {
diff --git a/bin/core/imag-store/src/get.rs b/bin/core/imag-store/src/get.rs
index b9324fef..666bbb92 100644
--- a/bin/core/imag-store/src/get.rs
+++ b/bin/core/imag-store/src/get.rs
@@ -34,8 +34,11 @@ pub fn get(rt: &Runtime) {
let path = StoreId::new(store, path).map_err_trace_exit_unwrap(1);
debug!("path = {:?}", path);
- let _ = match rt.store().get(path).map_err_trace_exit_unwrap(1) {
- Some(entry) => print_entry(rt, scmd, entry),
+ let _ = match rt.store().get(path.clone()).map_err_trace_exit_unwrap(1) {
+ Some(entry) => {
+ print_entry(rt, scmd, entry);
+ let _ = rt.report_touched(&path).map_err_trace_exit_unwrap(1);
+ },
None => info!("No entry found"),
};
}
diff --git a/bin/core/imag-store/src/retrieve.rs b/bin/core/imag-store/src/retrieve.rs
index 68ef5491..69201f8e 100644
--- a/bin/core/imag-store/src/retrieve.rs
+++ b/bin/core/imag-store/src/retrieve.rs
@@ -42,11 +42,13 @@ pub fn retrieve(rt: &Runtime) {
debug!("path = {:?}", path);
rt.store()
- .retrieve(path)
+ .retrieve(path.clone())
.map(|e| print_entry(rt, scmd, e))
.map_dbg_str("No entry")
.map_dbg(|e| format!("{:?}", e))
- .map_err_trace()
+ .map_err_trace_exit_unwrap(1);
+
+ let _ = rt.report_touched(&path).map_err_trace_exit_unwrap(1);
});
}
diff --git a/bin/core/imag-store/src/update.rs b/bin/core/imag-store/src/update.rs
index 981c8089..9bb0d943 100644
--- a/bin/core/imag-store/src/update.rs
+++ b/bin/core/imag-store/src/update.rs
@@ -36,16 +36,20 @@ pub fn update(rt: &Runtime) {
let _ = rt.store()
.retrieve(path)
.map(|mut locked_e| {
- let e = locked_e.deref_mut();
+ {
+ let e = locked_e.deref_mut();
- scmd.value_of("content")
- .map(|new_content| {
- *e.get_content_mut() = String::from(new_content);
- debug!("New content set");
- });
+ scmd.value_of("content")
+ .map(|new_content| {
+ *e.get_content_mut() = String::from(new_content);
+ debug!("New content set");
+ });
- *e.get_header_mut() = build_toml_header(scmd, e.get_header().clone());
- debug!("New header set");
+ *e.get_header_mut() = build_toml_header(scmd, e.get_header().clone());
+ debug!("New header set");
+ }
+
+ let _ = rt.report_touched(locked_e.get_location()).map_err_trace_exit_unwrap(1);
});
}
diff --git a/bin/core/imag-store/src/verify.rs b/bin/core/imag-store/src/verify.rs
index 8fa00981..9abefb5e 100644
--- a/bin/core/imag-store/src/verify.rs
+++ b/bin/core/imag-store/src/verify.rs
@@ -47,6 +47,7 @@ pub fn verify(rt: &Runtime) {
};
info!("{: >6} | {: >14} | {:?}", verify, content_len, p.deref());
+ let _ = rt.report_touched(fle.get_location()).map_err_trace_exit_unwrap(1);
status
});