watcher

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandler

type EventHandler interface {
	Start(ctx context.Context)
	Stop()
}

EventHandler can handle notifications for events that happen to a resource. Start will be waiting for the events notification which is responsible for invoking the registered user defined functions. Stop used to stop the watcher.

type EventHandlerFuncs

type EventHandlerFuncs struct {
	ListOptions *cr.ListOptions
	K8sObject   k8s.ObjectList
	Cfg         *rest.Config
	// contains filtered or unexported fields
}

EventHandlerFuncs is an adaptor to let you easily specify as many or as few of functions to invoke while getting notification from watcher

func (*EventHandlerFuncs) Start

func (e *EventHandlerFuncs) Start(ctx context.Context) error

Start triggers the registered methods based on the event received for particular k8s resources

func (*EventHandlerFuncs) Stop

func (e *EventHandlerFuncs) Stop()

Stop triggers stopping a particular k8s watch resources

func (*EventHandlerFuncs) WithAddFunc

func (e *EventHandlerFuncs) WithAddFunc(addfn func(obj interface{})) *EventHandlerFuncs

SetAddFunc used to set action on create event

func (*EventHandlerFuncs) WithDeleteFunc

func (e *EventHandlerFuncs) WithDeleteFunc(deletefn func(obj interface{})) *EventHandlerFuncs

SetDeleteFunc sets action for delete events

func (*EventHandlerFuncs) WithUpdateFunc

func (e *EventHandlerFuncs) WithUpdateFunc(updatefn func(updated interface{})) *EventHandlerFuncs

SetUpdateFunc sets action for any update events

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳