Merge pull request #897 from matthiasbeyer/libimagstore/verify-panic

Libimagstore/verify panic
This commit is contained in:
Matthias Beyer 2017-02-23 14:42:39 +01:00 committed by GitHub
commit ef07c2cba9

View file

@ -376,13 +376,14 @@ 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 {
.all(|res| match res {
Ok(dent) => {
if dent.file_type().is_file() {
match self.get(PathBuf::from(dent.path())) {
@ -396,29 +397,34 @@ impl Store {
};
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
}
},
Err(e) => {
trace_error_dbg(&e);
if_cfg_panic!("Error verifying: {:?}", e);
debug!("{:?}", e);
false
},
}
true
})
.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);