diff --git a/stage.go b/stage.go index 3537083..d5216ee 100644 --- a/stage.go +++ b/stage.go @@ -51,7 +51,7 @@ func (s *stage) chain(p Plugin) { fin, _ := p.(Finalizer) if init != nil { - if err := init.Initialize(); err != nil { + if err := init.Initialize(s); err != nil { s.gs.fault(nil, err) return } @@ -63,7 +63,7 @@ func (s *stage) chain(p Plugin) { go func() { defer wg.Done() for f := range s.input { - if proc == nil || accept != nil && !accept.Accept(f) { + if proc == nil || accept != nil && !accept.Accept(s, f) { s.output <- f } else { f.rewind() diff --git a/types.go b/types.go index f35f66b..415b465 100644 --- a/types.go +++ b/types.go @@ -87,11 +87,11 @@ func (e *Error) Error() string { } type Initializer interface { - Initialize() error + Initialize(ctx Context) error } type Accepter interface { - Accept(file File) bool + Accept(ctx Context, file File) bool } type Finalizer interface {