Add store path member for delete hook

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

View file

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