watch

package
v0.0.0-...-4efcaec Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager records which GVK's are watched. When a new GVK needs to be watches, it adds the watch to the associated controller.

func NewManager

func NewManager(cfg *rest.Config, decls *resourcemap.ResourceMap, channel chan event.GenericEvent, options *Options) (*Manager, error)

NewManager starts a new watch manager

func (*Manager) IsWatched

func (m *Manager) IsWatched(gvk schema.GroupVersionKind) bool

IsWatched returns whether the given GVK is being watched

func (*Manager) Len

func (m *Manager) Len() int

Len returns the number of types that are currently watched.

func (*Manager) NeedsUpdate

func (m *Manager) NeedsUpdate() bool

NeedsUpdate returns true if the Manager's watches need to be updated. This function is threadsafe.

func (*Manager) UpdateWatches

func (m *Manager) UpdateWatches(ctx context.Context, gvkMap map[schema.GroupVersionKind]struct{}) error

UpdateWatches accepts a map of GVKs that should be watched and takes the following actions: - stop watchers for any GroupVersionKind that is not present in the given map. - start watchers for any GroupVersionKind that is present in the given map and not present in the current watch map.

This function is threadsafe.

type Options

type Options struct {
	// Mapper is the RESTMapper to use for mapping GroupVersionKinds to Resources.
	Mapper meta.RESTMapper
	// contains filtered or unexported fields
}

Options contains options for creating a watch manager.

func DefaultOptions

func DefaultOptions(cfg *rest.Config) (*Options, error)

DefaultOptions return the default options: - create discovery RESTmapper from the passed rest.Config - use createWatcher to create watchers

type Runnable

type Runnable interface {
	Stop()
	Run(ctx context.Context) error
}

Runnable defines the custom watch interface.

func NewFiltered

func NewFiltered(_ context.Context, cfg watcherConfig) Runnable

NewFiltered returns a new filtered watch initialized with the given options.

Jump to

Keyboard shortcuts

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