Merge pull request #454 from matthiasbeyer/libimagstore/hook-exec-error-fix

Libimagstore/hook exec error fix
This commit is contained in:
Matthias Beyer 2016-05-29 01:31:17 +02:00
commit 9d37ffef91
2 changed files with 7 additions and 4 deletions

View file

@ -1,19 +1,22 @@
use std::fmt::Debug;
use hook::result::HookResult; use hook::result::HookResult;
use store::FileLockEntry; use store::FileLockEntry;
use storeid::StoreId; use storeid::StoreId;
pub trait StoreIdAccessor : Send + Sync { pub trait StoreIdAccessor : Debug + Send + Sync {
fn access(&self, &StoreId) -> HookResult<()>; fn access(&self, &StoreId) -> HookResult<()>;
} }
pub trait MutableHookDataAccessor : Send + Sync { pub trait MutableHookDataAccessor : Debug + Send + Sync {
fn access_mut(&self, &mut FileLockEntry) -> HookResult<()>; fn access_mut(&self, &mut FileLockEntry) -> HookResult<()>;
} }
pub trait NonMutableHookDataAccessor : Send + Sync { pub trait NonMutableHookDataAccessor : Debug + Send + Sync {
fn access(&self, &FileLockEntry) -> HookResult<()>; fn access(&self, &FileLockEntry) -> HookResult<()>;
} }
#[derive(Debug)]
pub enum HookDataAccessor<'a> { pub enum HookDataAccessor<'a> {
StoreIdAccess(&'a StoreIdAccessor), StoreIdAccess(&'a StoreIdAccessor),
MutableAccess(&'a MutableHookDataAccessor), MutableAccess(&'a MutableHookDataAccessor),

View file

@ -372,7 +372,7 @@ impl Store {
}) })
.map(|e| FileLockEntry::new(self, e, id)) .map(|e| FileLockEntry::new(self, e, id))
.and_then(|mut fle| { .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)))) .map_err(|e| SE::new(SEK::HookExecutionError, Some(Box::new(e))))
.and(Ok(fle)) .and(Ok(fle))
}) })