summaryrefslogtreecommitdiff
path: root/bin/core/imag-store
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-02-03 19:53:50 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-02-11 03:22:56 +0100
commitf1a639ea8ca400db5de0864d76a8c2f374bc2bb4 (patch)
treebc0830fb6c00551b0e4e076e5c302e8438fde4e1 /bin/core/imag-store
parent19912f5e88bf0c0f1a1c521f6f5109ee6fac8cff (diff)
downloadimag-f1a639ea8ca400db5de0864d76a8c2f374bc2bb4.zip
imag-f1a639ea8ca400db5de0864d76a8c2f374bc2bb4.tar.gz
Change id reporting API to return ExitCode
Because this API only errors when write!() errors occur, we can return the exit code as an error here. This way the user of the API can immediately exit if there was an IO error, but the API automatically takes care of the right return value, returning (exiting) with zero (0) if there was an "Broken pipe" error and with one (1) otherwise, which is the expected behaviour here. All calls to that API were changed accordingly. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/core/imag-store')
-rw-r--r--bin/core/imag-store/src/create.rs2
-rw-r--r--bin/core/imag-store/src/get.rs2
-rw-r--r--bin/core/imag-store/src/retrieve.rs2
-rw-r--r--bin/core/imag-store/src/update.rs2
-rw-r--r--bin/core/imag-store/src/verify.rs2
5 files changed, 5 insertions, 5 deletions
diff --git a/bin/core/imag-store/src/create.rs b/bin/core/imag-store/src/create.rs
index fcfc8ec..527a89f 100644
--- a/bin/core/imag-store/src/create.rs
+++ b/bin/core/imag-store/src/create.rs
@@ -63,7 +63,7 @@ pub fn create(rt: &Runtime) {
}
.map_err_trace_exit_unwrap(1);
- let _ = rt.report_touched(&path).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&path).unwrap_or_exit();
}
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 271c722..2f1cf87 100644
--- a/bin/core/imag-store/src/get.rs
+++ b/bin/core/imag-store/src/get.rs
@@ -37,7 +37,7 @@ pub fn get(rt: &Runtime) {
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);
+ let _ = rt.report_touched(&path).unwrap_or_exit();
},
None => info!("No entry found"),
};
diff --git a/bin/core/imag-store/src/retrieve.rs b/bin/core/imag-store/src/retrieve.rs
index 533e45a..4a20d33 100644
--- a/bin/core/imag-store/src/retrieve.rs
+++ b/bin/core/imag-store/src/retrieve.rs
@@ -48,7 +48,7 @@ pub fn retrieve(rt: &Runtime) {
.map_dbg(|e| format!("{:?}", e))
.map_err_trace_exit_unwrap(1);
- let _ = rt.report_touched(&path).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&path).unwrap_or_exit();
});
}
diff --git a/bin/core/imag-store/src/update.rs b/bin/core/imag-store/src/update.rs
index 084788e..1302f3d 100644
--- a/bin/core/imag-store/src/update.rs
+++ b/bin/core/imag-store/src/update.rs
@@ -49,7 +49,7 @@ pub fn update(rt: &Runtime) {
debug!("New header set");
}
- let _ = rt.report_touched(locked_e.get_location()).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(locked_e.get_location()).unwrap_or_exit();
});
}
diff --git a/bin/core/imag-store/src/verify.rs b/bin/core/imag-store/src/verify.rs
index cd2f183..6f2b96a 100644
--- a/bin/core/imag-store/src/verify.rs
+++ b/bin/core/imag-store/src/verify.rs
@@ -47,7 +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);
+ let _ = rt.report_touched(fle.get_location()).unwrap_or_exit();
status
});