From 37a505609e1e4a669f06985b1f68a56e07bdd470 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 4 Mar 2016 19:19:54 +0100 Subject: [PATCH] Remove hook traits. There can only be one trait: Hook --- libimagstore/src/hook/create.rs | 13 ------------- libimagstore/src/hook/delete.rs | 14 -------------- libimagstore/src/hook/mod.rs | 9 +++------ libimagstore/src/hook/read.rs | 13 ------------- libimagstore/src/hook/retrieve.rs | 13 ------------- libimagstore/src/hook/update.rs | 12 ------------ libimagstore/src/store.rs | 5 ----- 7 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 libimagstore/src/hook/create.rs delete mode 100644 libimagstore/src/hook/delete.rs delete mode 100644 libimagstore/src/hook/read.rs delete mode 100644 libimagstore/src/hook/retrieve.rs delete mode 100644 libimagstore/src/hook/update.rs diff --git a/libimagstore/src/hook/create.rs b/libimagstore/src/hook/create.rs deleted file mode 100644 index f43dd224..00000000 --- a/libimagstore/src/hook/create.rs +++ /dev/null @@ -1,13 +0,0 @@ -use storeid::StoreId; -use store::FileLockEntry; -use hook::accessor::HookDataAccessorProvider; -use hook::result::HookResult; -use hook::Hook; - -pub trait PreCreateHook : Hook { - fn pre_create(&self, &StoreId) -> HookResult<()>; -} - -pub trait PostCreateHook : Hook + HookDataAccessorProvider { -} - diff --git a/libimagstore/src/hook/delete.rs b/libimagstore/src/hook/delete.rs deleted file mode 100644 index 53d57cef..00000000 --- a/libimagstore/src/hook/delete.rs +++ /dev/null @@ -1,14 +0,0 @@ -use storeid::StoreId; -use store::FileLockEntry; -use hook::accessor::HookDataAccessorProvider; -use hook::result::HookResult; -use hook::Hook; - -pub trait PreDeleteHook : Hook { - fn pre_delete(&self, &StoreId) -> HookResult<()>; -} - -pub trait PostDeleteHook : Hook { - fn post_delete(&self, &StoreId) -> HookResult<()>; -} - diff --git a/libimagstore/src/hook/mod.rs b/libimagstore/src/hook/mod.rs index 43025591..ac8c7c89 100644 --- a/libimagstore/src/hook/mod.rs +++ b/libimagstore/src/hook/mod.rs @@ -7,15 +7,12 @@ use store::FileLockEntry; pub mod accessor; pub mod aspect; -pub mod create; -pub mod delete; pub mod error; -pub mod read; pub mod result; -pub mod retrieve; -pub mod update; -pub trait Hook : Debug + Send + Sync { +use hook::accessor::HookDataAccessorProvider; + +pub trait Hook : HookDataAccessorProvider + Debug + Send + Sync { fn set_config(&mut self, cfg: Value); } diff --git a/libimagstore/src/hook/read.rs b/libimagstore/src/hook/read.rs deleted file mode 100644 index f7a338c5..00000000 --- a/libimagstore/src/hook/read.rs +++ /dev/null @@ -1,13 +0,0 @@ -use storeid::StoreId; -use store::FileLockEntry; -use hook::accessor::HookDataAccessorProvider; -use hook::result::HookResult; -use hook::Hook; - -pub trait PreReadHook : Hook { - fn pre_read(&self, &StoreId) -> HookResult<()>; -} - -pub trait PostReadHook : Hook + HookDataAccessorProvider { -} - diff --git a/libimagstore/src/hook/retrieve.rs b/libimagstore/src/hook/retrieve.rs deleted file mode 100644 index db238ff0..00000000 --- a/libimagstore/src/hook/retrieve.rs +++ /dev/null @@ -1,13 +0,0 @@ -use storeid::StoreId; -use store::FileLockEntry; -use hook::accessor::HookDataAccessorProvider; -use hook::result::HookResult; -use hook::Hook; - -pub trait PreRetrieveHook : Hook { - fn pre_retrieve(&self, &StoreId) -> HookResult<()>; -} - -pub trait PostRetrieveHook : Hook + HookDataAccessorProvider { -} - diff --git a/libimagstore/src/hook/update.rs b/libimagstore/src/hook/update.rs deleted file mode 100644 index 21687222..00000000 --- a/libimagstore/src/hook/update.rs +++ /dev/null @@ -1,12 +0,0 @@ -use store::FileLockEntry; -use hook::accessor::HookDataAccessorProvider; -use hook::result::HookResult; -use hook::Hook; - -pub trait PreUpdateHook : Hook { - fn pre_update(&self, &FileLockEntry) -> HookResult<()>; -} - -pub trait PostUpdateHook : Hook + HookDataAccessorProvider { -} - diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index c07c30d0..1c19e1c6 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -28,11 +28,6 @@ use hook::accessor::{ MutableHookDataAccessor, NonMutableHookDataAccessor, HookDataAccessor, HookDataAccessorProvider}; -use hook::read::{PreReadHook, PostReadHook}; -use hook::create::{PreCreateHook, PostCreateHook}; -use hook::retrieve::{PreRetrieveHook, PostRetrieveHook}; -use hook::update::{PreUpdateHook, PostUpdateHook}; -use hook::delete::{PreDeleteHook, PostDeleteHook}; /// The Result Type returned by any interaction with the store that could fail pub type Result = RResult;