watch

package
v1.18.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package watch implements a garbage collector for composed resource watches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerEngine

type ControllerEngine interface {
	GetWatches(name string) ([]engine.WatchID, error)
	StopWatches(ctx context.Context, name string, ws ...engine.WatchID) (int, error)
	GetClient() client.Client
}

A ControllerEngine can get and stop watches for a controller.

type GarbageCollector

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

A GarbageCollector garbage collects watches for a single composite resource (XR) controller. A watch is eligible for garbage collection when none of the XRs the controller owns resource references its GVK. The garbage collector periodically lists all of the controller's XRs to determine what GVKs they still reference.

func NewGarbageCollector

NewGarbageCollector creates a new watch garbage collector for a controller.

func (*GarbageCollector) GarbageCollectWatches

func (gc *GarbageCollector) GarbageCollectWatches(ctx context.Context, interval time.Duration)

GarbageCollectWatches runs garbage collection at the specified interval, until the supplied context is cancelled. It stops any watches for resource types that are no longer composed by any composite resource (XR).

func (*GarbageCollector) GarbageCollectWatchesNow

func (gc *GarbageCollector) GarbageCollectWatchesNow(ctx context.Context) error

GarbageCollectWatchesNow stops any watches for resource types that are no longer composed by any composite resource (XR). It's safe to call from multiple goroutines.

type GarbageCollectorOption

type GarbageCollectorOption func(gc *GarbageCollector)

A GarbageCollectorOption configures a GarbageCollector.

func WithLogger

WithLogger configures how a GarbageCollector should log.

Jump to

Keyboard shortcuts

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