Help us shape the future of Go! Take the 2026 Go Developer Survey

watcher

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher[T1 any] struct {
	// interfce to the observer
	Cancel         func()
	ResultChannel  chan watch.WatchEvent[T1]
	WatcherManager watchermanager.WatcherManager[T1]
	New            func() T1
	// contains filtered or unexported fields
}

implements the watchermanager Watcher interface implenents the k8s watch.Interface interface

func (*Watcher[T1]) ListAndWatch

func (r *Watcher[T1]) ListAndWatch(ctx context.Context, store store.Storer[T1], opts ...store.ListOption)

func (*Watcher[T1]) OnChange

func (r *Watcher[T1]) OnChange(eventType watch.WatchEvent[T1]) bool

Implement the watcchermanafer.Watcher interface OnChange is the callback called when a object changes.

func (*Watcher[T1]) ResultChan

func (r *Watcher[T1]) ResultChan() <-chan watch.WatchEvent[T1]

ResultChan returns a chan which will receive all the events. If an error occurs or Stop() is called, the implementation will close this channel and release any resources used by the watch.

func (*Watcher[T1]) Stop

func (r *Watcher[T1]) Stop()

Stop stops watching. Will close the channel returned by ResultChan(). Releases any resources used by the watch.

type WatcherU

type WatcherU struct {
	// interfce to the observer
	Cancel         func()
	ResultChannel  chan watch.WatchEvent[runtime.Unstructured]
	WatcherManager watchermanager.WatcherManager[runtime.Unstructured]
	New            func() runtime.Unstructured
	// contains filtered or unexported fields
}

implements the watchermanager Watcher interface implenents the k8s watch.Interface interface

func (*WatcherU) ListAndWatch

func (r *WatcherU) ListAndWatch(ctx context.Context, store store.UnstructuredStore, opts ...store.ListOption)

func (*WatcherU) OnChange

func (r *WatcherU) OnChange(eventType watch.WatchEvent[runtime.Unstructured]) bool

Implement the watcchermanafer.Watcher interface OnChange is the callback called when a object changes.

func (*WatcherU) ResultChan

func (r *WatcherU) ResultChan() <-chan watch.WatchEvent[runtime.Unstructured]

ResultChan returns a chan which will receive all the events. If an error occurs or Stop() is called, the implementation will close this channel and release any resources used by the watch.

func (*WatcherU) Stop

func (r *WatcherU) Stop()

Stop stops watching. Will close the channel returned by ResultChan(). Releases any resources used by the watch.

Jump to

Keyboard shortcuts

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