filter

package
v0.1.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COMPARISON_EQUALITY     = "equality"
	COMPARISON_BITAND       = "bitand"
	COMPARISON_PATTERNMATCH = "patternmatch"
)

Variables

View Source
var (
	ErrUnknownComparisonOperation = func(op string) error { return fmt.Errorf("unknown comparison operation: %s\n", op) }
)

Functions

func CompareFields

func CompareFields(lhs, rhs interface{}, mapping map[string]*MappedField) (bool, error)

CompareFields checks if ALL fields in lhs struct match the rhs struct. Generally, the lhs is the filter and the rhs is the event.

Types

type ComparisonOperation

type ComparisonOperation string

type Filter

type Filter interface {
	// FilterFunc takes an arbitrary event and returns a bool
	// representing whether or not we should include this event
	FilterFunc(interface{}) bool
	// DoFunc performs some action or side effect per arbitrary event
	DoFunc(interface{})
}

Filter exports an interface for filtering events

func NewContainerFilter

func NewContainerFilter(ecf *api.ContainerFilter) Filter

NewContainerFilter creates a new ContainerEvent filter

func NewEventFilter

func NewEventFilter(ef *api.EventFilter) Filter

type MappedField

type MappedField struct {
	Name string
	Op   ComparisonOperation
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL