Implement: execute_pre_read_hooks()

This commit is contained in:
Matthias Beyer 2016-02-16 22:33:06 +01:00
parent ac280ba616
commit 975a2bc8b9
1 changed files with 6 additions and 1 deletions

View File

@ -404,7 +404,12 @@ impl Store {
}
pub fn execute_pre_read_hooks(&self, id: &StoreId) -> Result<()> {
unimplemented!()
let guard = self.pre_read_hooks.deref().lock();
if guard.is_err() { return Err(StoreError::new(StoreErrorKind::PreHookExecuteError, None)) }
guard.unwrap().deref().iter()
.fold(Ok(()), |acc, hook| acc.and_then(|_| hook.pre_read(id)))
.map_err(|e| StoreError::new(StoreErrorKind::PreHookExecuteError, Some(Box::new(e))))
}
pub fn execute_post_read_hooks<'a>(&'a self, fle: FileLockEntry<'a>)