From 20cd5d48edee289bcf01facf06253b99bdccb55e Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 20 Dec 2015 17:47:46 +0900 Subject: [PATCH] API tweaks --- stage.go | 4 ++-- types.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 {