mirror of https://github.com/docker/docs.git
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:
parent
5f3812ec97
commit
caf9b19b0c
|
|
@ -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
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue