observe

package
v0.0.0-...-463644e Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSubjectToInformerEventAdapater

func NewSubjectToInformerEventAdapater[T any](subject Subject[T]) cache.ResourceEventHandler

NewSubjectToInformerEventAdapater adapts a Subject to a cache.ResourceEventHandler that can be used with K8S informers as argument to informer.AddEventHandler(...)

Types

type Filter

type Filter[T any] struct {
	Predicate FilterPredicate[T]
	// contains filtered or unexported fields
}

Filter implements Observer and Observable Objectes received by the filter's observer implementation is filtered with the Condition function before emitted by the filter's observable implementation

func (*Filter) AttachObserver

func (o *Filter) AttachObserver(observer Observer[T])

func (*Filter) DetachObserver

func (o *Filter) DetachObserver(observer Observer[T])

func (*Filter[T]) Receive

func (f *Filter[T]) Receive(obj T)

type FilterPredicate

type FilterPredicate[T any] interface {
	Filter(obj T) bool
}

FilterPredicate defines the Filter method to be used with the Filter struct

type FilterPredicateFunc

type FilterPredicateFunc[T any] func(obj T) bool

FilterPredicateFunc type is an adapter to allow the use of ordinary functions as FilterPredicate

func (FilterPredicateFunc[T]) Filter

func (f FilterPredicateFunc[T]) Filter(obj T) bool

type ImageInfo

type ImageInfo struct {
	ImageName   string
	DockerAuths dockercfg.DockerAuthConfig
}

ImageInfo is sent to observers of RadixDeploymentContainerImageMapper

type Observable

type Observable[T any] interface {
	// AttachObserver registers an Observer that will receive values emitted by the Observable
	AttachObserver(observer Observer[T])
	// AttachObserver un-registers an Observer from the Observable to stop it from receiving values
	DetachObserver(observer Observer[T])
}

Observable defines a type that can emit values to an Observer

func NewCron

func NewCron[T any](ctx context.Context, cronSpec string, notifyValueFunc func() T) (Observable[T], error)

NewCron creates an Observable that emits the value returned by notifyValueFunc to attached observers on times defined by the cronSpec

type Observer

type Observer[T any] interface {
	Receive(obj T)
}

Observer defines an object that can be attached to an Observable

type RadixDeploymentContainerImageMapper

type RadixDeploymentContainerImageMapper struct {
	KubeClient kubernetes.Interface
	// contains filtered or unexported fields
}

RadixDeploymentContainerImageMapper receives RadixDeployments and emits images defined in jobs and componenets together with docker auths data to any observers

func (*RadixDeploymentContainerImageMapper) AttachObserver

func (o *RadixDeploymentContainerImageMapper) AttachObserver(observer Observer[T])

func (*RadixDeploymentContainerImageMapper) DetachObserver

func (o *RadixDeploymentContainerImageMapper) DetachObserver(observer Observer[T])

func (*RadixDeploymentContainerImageMapper) Receive

type RadixDeploymentFilter

type RadixDeploymentFilter struct {
	Filter[*v1.RadixDeployment]
}

RadixDeploymentFilter defines a base for performing filtering on RadixDeployment objects

func ActiveRadixDeploymentFilter

func ActiveRadixDeploymentFilter() *RadixDeploymentFilter

ActiveRadixDeploymentFilter creates a RadixDeploymentFilter that filters out any RadixDeployment that is not the active RD

func ExcludeRadixAppNamesFilter

func ExcludeRadixAppNamesFilter(excludeAppNames []string) *RadixDeploymentFilter

ExcludeRadixAppNamesFilter creates a RadixDeploymentFilter that filters out any RadixDeployment belonging to applications specified in the excludeAppNames parameter

func (*RadixDeploymentFilter) AttachObserver

func (o *RadixDeploymentFilter) AttachObserver(observer Observer[T])

func (*RadixDeploymentFilter) DetachObserver

func (o *RadixDeploymentFilter) DetachObserver(observer Observer[T])

type RadixDeploymentListMapper

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

RadixDeploymentListMapper receives slices of RadixDeployments and emits each RadixDeployments to any observers

func (*RadixDeploymentListMapper) AttachObserver

func (o *RadixDeploymentListMapper) AttachObserver(observer Observer[T])

func (*RadixDeploymentListMapper) DetachObserver

func (o *RadixDeploymentListMapper) DetachObserver(observer Observer[T])

func (*RadixDeploymentListMapper) Receive

func (m *RadixDeploymentListMapper) Receive(rds []*v1.RadixDeployment)

type Subject

type Subject[T any] interface {
	Observable[T]
	Next(T)
}

Subject is a type of Observable that emits values to attached observers using the Next(T) method

func NewSubject

func NewSubject[T any]() Subject[T]

Jump to

Keyboard shortcuts

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