Implement: execute_pre_delete_hooks()

This commit is contained in:
Matthias Beyer 2016-02-16 22:52:47 +01:00
parent 5aa663987b
commit 09acddaef9

View file

@ -462,7 +462,12 @@ impl Store {
} }
pub fn execute_pre_delete_hooks(&self, id: &StoreId) -> Result<()> { pub fn execute_pre_delete_hooks(&self, id: &StoreId) -> Result<()> {
unimplemented!() let guard = self.pre_delete_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_delete(id)))
.map_err(|e| StoreError::new(StoreErrorKind::PreHookExecuteError, Some(Box::new(e))))
} }
pub fn execute_post_delete_hooks(&self, id: &StoreId) -> Result<()> { pub fn execute_post_delete_hooks(&self, id: &StoreId) -> Result<()> {