summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-02-23 14:42:39 +0100
committerGitHub <noreply@github.com>2017-02-23 14:42:39 +0100
commitef07c2cba946d930e72bd5576b738987e09c2593 (patch)
tree1921209ecebfe6af67f771467a016d7d054a2127
parentf3af9e0ac41c3d0eb3820a04f20630af79160804 (diff)
parent2d199ce3ec54a21f327b364e44d7e54a5522c9cb (diff)
downloadimag-ef07c2cba946d930e72bd5576b738987e09c2593.zip
imag-ef07c2cba946d930e72bd5576b738987e09c2593.tar.gz
Merge pull request #897 from matthiasbeyer/libimagstore/verify-panic
Libimagstore/verify panic
-rw-r--r--libimagstore/src/store.rs77
1 files changed, 41 insertions, 36 deletions
diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs
index e90750a..7ccb074 100644
--- a/libimagstore/src/store.rs
+++ b/libimagstore/src/store.rs
@@ -376,49 +376,55 @@ impl Store {
/// This function is not intended to be called by normal programs but only by `imag-store`.
#[cfg(feature = "verify")]
pub fn verify(&self) -> bool {
+ use libimagerror::trace::trace_error_dbg;
+
info!("Header | Content length | Path");
info!("-------+----------------+-----");
WalkDir::new(self.location.clone())
.into_iter()
- .map(|res| {
- match res {
- Ok(dent) => {
- if dent.file_type().is_file() {
- match self.get(PathBuf::from(dent.path())) {
- Ok(Some(fle)) => {
- let p = fle.get_location();
- let content_len = fle.get_content().len();
- let header = if fle.get_header().verify().is_ok() {
- "ok"
- } else {
- "broken"
- };
-
- info!("{: >6} | {: >14} | {:?}", header, content_len, p.deref());
- },
-
- Ok(None) => {
- info!("{: >6} | {: >14} | {:?}", "?", "couldn't load", dent.path());
- },
-
- Err(e) => {
- debug!("{:?}", e);
- },
- }
- } else {
- info!("{: >6} | {: >14} | {:?}", "?", "<no file>", dent.path());
- }
- },
+ .all(|res| match res {
+ Ok(dent) => {
+ if dent.file_type().is_file() {
+ match self.get(PathBuf::from(dent.path())) {
+ Ok(Some(fle)) => {
+ let p = fle.get_location();
+ let content_len = fle.get_content().len();
+ let header = if fle.get_header().verify().is_ok() {
+ "ok"
+ } else {
+ "broken"
+ };
- Err(e) => {
- debug!("{:?}", e);
- },
- }
+ info!("{: >6} | {: >14} | {:?}", header, content_len, p.deref());
+ true
+ },
+
+ Ok(None) => {
+ info!("{: >6} | {: >14} | {:?}", "?", "couldn't load", dent.path());
+ true
+ },
+
+ Err(e) => {
+ trace_error_dbg(&e);
+ if_cfg_panic!("Error verifying: {:?}", e);
+ debug!("{:?}", e);
+ false
+ },
+ }
+ } else {
+ info!("{: >6} | {: >14} | {:?}", "?", "<no file>", dent.path());
+ true
+ }
+ },
- true
+ Err(e) => {
+ trace_error_dbg(&e);
+ if_cfg_panic!("Error verifying: {:?}", e);
+ debug!("{:?}", e);
+ false
+ },
})
- .all(|b| b)
}
/// Creates the Entry at the given location (inside the entry)
@@ -1130,7 +1136,6 @@ impl<'a> Drop for FileLockEntry<'a> {
/// intended for production use, though).
fn drop(&mut self) {
use libimagerror::trace::trace_error_dbg;
-
match self.store._update(self, true) {
Err(e) => {
trace_error_dbg(&e);