API tweaks

This commit is contained in:
Alex Yatskov 2015-12-20 17:47:46 +09:00
parent 2f684bb48d
commit 20cd5d48ed
2 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ func (s *stage) chain(p Plugin) {
fin, _ := p.(Finalizer) fin, _ := p.(Finalizer)
if init != nil { if init != nil {
if err := init.Initialize(); err != nil { if err := init.Initialize(s); err != nil {
s.gs.fault(nil, err) s.gs.fault(nil, err)
return return
} }
@ -63,7 +63,7 @@ func (s *stage) chain(p Plugin) {
go func() { go func() {
defer wg.Done() defer wg.Done()
for f := range s.input { 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 s.output <- f
} else { } else {
f.rewind() f.rewind()

View File

@ -87,11 +87,11 @@ func (e *Error) Error() string {
} }
type Initializer interface { type Initializer interface {
Initialize() error Initialize(ctx Context) error
} }
type Accepter interface { type Accepter interface {
Accept(file File) bool Accept(ctx Context, file File) bool
} }
type Finalizer interface { type Finalizer interface {