Add store path member for create hook

This commit is contained in:
Matthias Beyer 2016-07-16 15:59:53 +02:00
parent f0404d91e8
commit 397c38d805

View file

@ -1,3 +1,5 @@
use std::path::PathBuf;
use toml::Value; use toml::Value;
use libimagstore::storeid::StoreId; use libimagstore::storeid::StoreId;
@ -8,15 +10,18 @@ use libimagstore::hook::accessor::{HookDataAccessor, HookDataAccessorProvider};
use libimagstore::hook::accessor::StoreIdAccessor; use libimagstore::hook::accessor::StoreIdAccessor;
#[derive(Debug)] #[derive(Debug)]
pub struct CreateHook { pub struct CreateHook<'a> {
storepath: &'a PathBuf,
position: HookPosition, position: HookPosition,
config: Option<Value>, config: Option<Value>,
} }
impl CreateHook { impl<'a> CreateHook<'a> {
pub fn new(p: HookPosition) -> CreateHook { pub fn new(storepath: &'a PathBuf, p: HookPosition) -> CreateHook<'a> {
CreateHook { CreateHook {
storepath: storepath,
position: p, position: p,
config: None, config: None,
} }
@ -24,7 +29,7 @@ impl CreateHook {
} }
impl Hook for CreateHook { impl<'a> Hook for CreateHook<'a> {
fn name(&self) -> &'static str { fn name(&self) -> &'static str {
"stdhook_git_create" "stdhook_git_create"
@ -36,14 +41,14 @@ impl Hook for CreateHook {
} }
impl HookDataAccessorProvider for CreateHook { impl<'a> HookDataAccessorProvider for CreateHook<'a> {
fn accessor(&self) -> HookDataAccessor { fn accessor(&self) -> HookDataAccessor {
HookDataAccessor::StoreIdAccess(self) HookDataAccessor::StoreIdAccess(self)
} }
} }
impl StoreIdAccessor for CreateHook { impl<'a> StoreIdAccessor for CreateHook<'a> {
fn access(&self, id: &StoreId) -> HookResult<()> { fn access(&self, id: &StoreId) -> HookResult<()> {
debug!("[GIT CREATE HOOK]: {:?}", id); debug!("[GIT CREATE HOOK]: {:?}", id);