Add Aspect type for hook system

This commit is contained in:
Matthias Beyer 2016-03-04 17:07:54 +01:00
parent 3e62b71605
commit be1ba5be4b
2 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,49 @@
use store::FileLockEntry;
use storeid::StoreId;
use hook::Hook;
use hook::result::HookResult;
use hook::accessor::{StoreIdAccessor, MutableHookDataAccessor, NonMutableHookDataAccessor};
#[derive(Debug)]
pub struct Aspect {
name: String,
hooks: Vec<Box<Hook>>,
}
impl Aspect {
pub fn new(name: String) -> Aspect {
Aspect {
name: name,
hooks: vec![],
}
}
pub fn name(&self) -> &String {
&self.name
}
pub fn register_hook(&mut self, h: Box<Hook>) {
self.hooks.push(h);
}
}
impl StoreIdAccessor for Aspect {
fn access(&self, id: &StoreId) -> HookResult<()> {
unimplemented!()
}
}
impl MutableHookDataAccessor for Aspect {
fn access_mut(&self, fle: &mut FileLockEntry) -> HookResult<()> {
unimplemented!()
}
}
impl NonMutableHookDataAccessor for Aspect {
fn access(&self, fle: &FileLockEntry) -> HookResult<()> {
unimplemented!()
}
}

View file

@ -6,6 +6,7 @@ use self::error::HookError;
use store::FileLockEntry;
pub mod accessor;
pub mod aspect;
pub mod create;
pub mod delete;
pub mod error;