watchers

package
v0.0.0-...-3ea6822 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSkipEvent = errors.New("event filtered")
)

Functions

Types

type Action

type Action uint8
const (
	Add Action = iota + 1
	Update
	Delete
	Cast
)

func (Action) String

func (a Action) String() string

type Chain

type Chain []Watcher

func (Chain) OnAdd

func (s Chain) OnAdd(obj schema.Object) error

func (Chain) OnDelete

func (s Chain) OnDelete(obj schema.Object) error

func (Chain) OnUpdate

func (s Chain) OnUpdate(oldObj, newObj schema.Object) error

type ErrorHandler

type ErrorHandler func(error)

type Event

type Event struct {
	Obj    schema.Object
	Action Action
}

type Filter

type Filter func(schema.Object) bool

func (Filter) OnAdd

func (f Filter) OnAdd(obj schema.Object) error

func (Filter) OnDelete

func (f Filter) OnDelete(obj schema.Object) error

func (Filter) OnUpdate

func (f Filter) OnUpdate(oldObj, newObj schema.Object) error

type Logger

type Logger struct {
	*zerolog.Logger
	Level zerolog.Level
}

func (Logger) OnAdd

func (l Logger) OnAdd(obj schema.Object) error

func (Logger) OnDelete

func (l Logger) OnDelete(obj schema.Object) error

func (Logger) OnUpdate

func (l Logger) OnUpdate(oldObj, newObj schema.Object) error

type PipelineError

type PipelineError struct {
	Err     error
	Object  interface{}
	Watcher Watcher
	Action  Action
}

func (PipelineError) Error

func (e PipelineError) Error() string

func (PipelineError) Unwrap

func (e PipelineError) Unwrap() error

type Publisher

type Publisher struct {
	C   chan<- Event
	Ctx context.Context
}

func (Publisher) OnAdd

func (p Publisher) OnAdd(obj schema.Object) error

func (Publisher) OnDelete

func (p Publisher) OnDelete(obj schema.Object) error

func (Publisher) OnUpdate

func (p Publisher) OnUpdate(oldObj, newObj schema.Object) error

type ResourceMetaSetter

type ResourceMetaSetter schema.Resource

func (ResourceMetaSetter) OnAdd

func (s ResourceMetaSetter) OnAdd(obj schema.Object) error

func (ResourceMetaSetter) OnDelete

func (s ResourceMetaSetter) OnDelete(obj schema.Object) error

func (ResourceMetaSetter) OnUpdate

func (s ResourceMetaSetter) OnUpdate(oldObj, newObj schema.Object) error

type TypeAssert

type TypeAssert[T any] struct{}

func (TypeAssert[T]) OnAdd

func (t TypeAssert[T]) OnAdd(obj schema.Object) error

func (TypeAssert[T]) OnDelete

func (t TypeAssert[T]) OnDelete(obj schema.Object) error

func (TypeAssert[T]) OnUpdate

func (t TypeAssert[T]) OnUpdate(oldObj, newObj schema.Object) error

type UpdateFilter

type UpdateFilter func(oldObj schema.Object, newObj schema.Object) bool

func (UpdateFilter) OnAdd

func (f UpdateFilter) OnAdd(obj schema.Object) error

func (UpdateFilter) OnDelete

func (f UpdateFilter) OnDelete(obj schema.Object) error

func (UpdateFilter) OnUpdate

func (f UpdateFilter) OnUpdate(oldObj, newObj schema.Object) error

type Watcher

type Watcher interface {
	OnAdd(obj schema.Object) error
	OnUpdate(oldObj, newObj schema.Object) error
	OnDelete(obj schema.Object) error
}

Jump to

Keyboard shortcuts

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