From 196be30d919e34181763deeee069c2d3855618a5 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 17 Feb 2016 15:25:08 +0100 Subject: [PATCH] Implement: execute_post_read_hooks() --- libimagstore/src/store.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 665563da..3afb167b 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -415,7 +415,18 @@ impl Store { pub fn execute_post_read_hooks<'a>(&'a self, fle: FileLockEntry<'a>) -> Result> { - unimplemented!() + self.post_read_hooks + .deref() + .lock() + .map_err(|e| StoreError::new(StoreErrorKind::PostHookExecuteError, None)) + .and_then(|guard| { + guard.deref() + .iter() + .fold(Ok(fle), move |file, hook| file.and_then(|f| hook.post_read(f))) + .map_err(|e| { + StoreError::new(StoreErrorKind::PostHookExecuteError, Some(Box::new(e))) + }) + }) } pub fn execute_pre_create_hooks(&self, id: &StoreId) -> Result<()> {