From 812379c46d74c996f37185b6bf557b7aa84844ba Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 28 May 2016 23:45:27 +0200 Subject: [PATCH 1/2] Hook data accessors should implement Debug --- libimagstore/src/hook/accessor.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libimagstore/src/hook/accessor.rs b/libimagstore/src/hook/accessor.rs index 88c8153b..e9d39915 100644 --- a/libimagstore/src/hook/accessor.rs +++ b/libimagstore/src/hook/accessor.rs @@ -1,19 +1,22 @@ +use std::fmt::Debug; + use hook::result::HookResult; use store::FileLockEntry; use storeid::StoreId; -pub trait StoreIdAccessor : Send + Sync { +pub trait StoreIdAccessor : Debug + Send + Sync { fn access(&self, &StoreId) -> HookResult<()>; } -pub trait MutableHookDataAccessor : Send + Sync { +pub trait MutableHookDataAccessor : Debug + Send + Sync { fn access_mut(&self, &mut FileLockEntry) -> HookResult<()>; } -pub trait NonMutableHookDataAccessor : Send + Sync { +pub trait NonMutableHookDataAccessor : Debug + Send + Sync { fn access(&self, &FileLockEntry) -> HookResult<()>; } +#[derive(Debug)] pub enum HookDataAccessor<'a> { StoreIdAccess(&'a StoreIdAccessor), MutableAccess(&'a MutableHookDataAccessor), From 64e28f3c319e53a46c034c57ef2f2216a5c2a9d8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 28 May 2016 23:45:44 +0200 Subject: [PATCH 2/2] Fix C/P fail The store executed the wrong hooks here, because of a C/P failure. This fixes this bug. --- libimagstore/src/store.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 36b05a0c..a9c22113 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -361,7 +361,7 @@ impl Store { }) .map(|e| FileLockEntry::new(self, e, id)) .and_then(|mut fle| { - self.execute_hooks_for_mut_file(self.pre_retrieve_aspects.clone(), &mut fle) + self.execute_hooks_for_mut_file(self.post_retrieve_aspects.clone(), &mut fle) .map_err(|e| SE::new(SEK::HookExecutionError, Some(Box::new(e)))) .and(Ok(fle)) })