Implement: execute_post_delete_hooks()

This commit is contained in:
Matthias Beyer 2016-02-17 16:05:59 +01:00
parent f703e8a4cd
commit bb0e7e2468
1 changed files with 12 additions and 1 deletions

View File

@ -515,7 +515,18 @@ impl Store {
}
pub fn execute_post_delete_hooks(&self, id: &StoreId) -> Result<()> {
unimplemented!()
self.post_delete_hooks
.deref()
.lock()
.map_err(|e| StoreError::new(StoreErrorKind::PostHookExecuteError, None))
.and_then(|guard| {
guard.deref()
.iter()
.fold(Ok(()), move |res, hook| res.and_then(|_| hook.post_delete(id)))
.map_err(|e| {
StoreError::new(StoreErrorKind::PostHookExecuteError, Some(Box::new(e)))
})
})
}
}