Implement: execute_pre_update_hooks()

This commit is contained in:
Matthias Beyer 2016-02-16 22:52:12 +01:00
parent 94128f8bcc
commit 5aa663987b

View file

@ -448,8 +448,13 @@ impl Store {
unimplemented!()
}
pub fn execute_pre_update_hooks(&self, id: &FileLockEntry) -> Result<()> {
unimplemented!()
pub fn execute_pre_update_hooks(&self, fle: &FileLockEntry) -> Result<()> {
let guard = self.pre_update_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_update(fle)))
.map_err(|e| StoreError::new(StoreErrorKind::PreHookExecuteError, Some(Box::new(e))))
}
pub fn execute_post_update_hooks(&self, id: &FileLockEntry) -> Result<()> {