eventhandler

package
v0.0.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Filters        []filtertypes.FilterMeta
	Actions        []actiontypes.ActionMeta
	FilterRegistry *filterregistry.Registry
	ActionRegistry *actionregistry.Registry
	Executor       *executor.Executor
}

type EventHandler

type EventHandler func(sourceType string, event interface{}, data interface{}) error

EventHandler is given to Source to be called. Source is responsible to call this function.

sourceType is what type the Source is.

event is what event happened, containing a brief event object. Do not include complex objects in it. For example, a k8s-resource-watcher Source may contain what event happened (create, update, delete) in it.

data is the detailed event, for machines to process, e.g. passed to filters to do filtering . You may put complex objects in it. For example, a k8s-resource-watcher Source may contain the entire object that is changed in it.

func New

func New() EventHandler

New create a new EventHandler that does nothing.

func NewFromConfig

func NewFromConfig(c Config) EventHandler

func (EventHandler) AddHandlerAfter

func (e EventHandler) AddHandlerAfter(eh EventHandler) EventHandler

AddHandlerAfter adds a new EventHandler to be called after e is called.

func (EventHandler) AddHandlerBefore

func (e EventHandler) AddHandlerBefore(eh EventHandler) EventHandler

AddHandlerBefore adds a new EventHandler to be called before e is called.

Jump to

Keyboard shortcuts

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