1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

filters: remove out filter proc prototype

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
This commit is contained in:
Vincent Batts 2014-03-26 14:48:56 -04:00
parent 5f3812ec97
commit caf9b19b0c

View file

@ -1,53 +0,0 @@
package filters
import (
"errors"
"fmt"
"io"
)
var DefaultFilterProcs = FilterProcSet{}
func Register(name string, fp FilterProc) error {
return DefaultFilterProcs.Register(name, fp)
}
var ErrorFilterExists = errors.New("filter already exists and ")
var ErrorFilterExistsConflict = errors.New("filter already exists and FilterProc are different")
type FilterProcSet map[string]FilterProc
func (fs FilterProcSet) Process(context string) {
}
func (fs FilterProcSet) Register(name string, fp FilterProc) error {
if v, ok := fs[name]; ok {
if v == fp {
return ErrorFilterExists
} else {
return ErrorFilterExistsConflict
}
}
fs[name] = fp
return nil
}
type FilterProc interface {
Process(context, key, value string, output io.Writer) error
}
type UnknownFilterProc struct{}
func (ufp UnknownFilterProc) Process(context, key, value string, output io.Writer) error {
if output != nil {
fmt.Fprintf(output, "do not know how to process [%s : %s]", key, value)
}
return nil
}
type Filter interface {
Scope() string
Target() string
Expressions() []string
Match(interface{}) bool
}