eventhandler

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 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 {
	Handler  map[v1alpha1.ActionMeta]string
	Executor *executor.Executor
}

Config is the config for trigger

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 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 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(ctx context.Context, cli client.Client, actionMeta v1alpha1.ActionMeta, filterMeta string, executor *executor.Executor) EventHandler

NewFromConfig creates a new EventHandler from config.

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