From f703e8a4cdabaefc131d2e7697f25071c11d391b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 17 Feb 2016 16:04:30 +0100 Subject: [PATCH] Implement: execute_post_update_hooks() --- libimagstore/src/store.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 753b30cb..9925413b 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -490,8 +490,19 @@ impl Store { .map_err(|e| StoreError::new(StoreErrorKind::PreHookExecuteError, Some(Box::new(e)))) } - pub fn execute_post_update_hooks(&self, id: &FileLockEntry) -> Result<()> { - unimplemented!() + pub fn execute_post_update_hooks(&self, fle: &FileLockEntry) -> Result<()> { + self.post_update_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_update(fle))) + .map_err(|e| { + StoreError::new(StoreErrorKind::PostHookExecuteError, Some(Box::new(e))) + }) + }) } pub fn execute_pre_delete_hooks(&self, id: &StoreId) -> Result<()> {