watch

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: 0 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultChanSize int32 = 100
)

Functions

This section is empty.

Types

type EventType

type EventType int
const (
	Added EventType = iota
	Modified
	Deleted
	Bookmark
	Error
)

func (EventType) String

func (r EventType) String() string

type WatchEvent

type WatchEvent[T1 any] struct {
	Type EventType

	// Object is:
	//  * If Type is Added or Modified: the new state of the object.
	//  * If Type is Deleted: the state of the object immediately before deletion.
	//  * If Type is Bookmark: the object (instance of a type being watched) where
	//    only ResourceVersion field is set. On successful restart of watch from a
	//    bookmark resourceVersion, client is guaranteed to not get repeat event
	//    nor miss any events.
	//  * If Type is Error: *api.Status is recommended; other types may make sense
	//    depending on context.
	Object T1
}

Event represents a single event to a watched resource. +k8s:deepcopy-gen=true

type WatchInterface

type WatchInterface[T1 any] interface {
	// Stop stops watching. Will close the channel returned by ResultChan(). Releases
	// any resources used by the watch.
	Stop()

	// 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.
	ResultChan() <-chan WatchEvent[T1]
}

Interface can be implemented by anything that knows how to watch and report changes.

Jump to

Keyboard shortcuts

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