event

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event[E api.Object] struct {
	Type   Type
	Object E
}

type Handler

type Handler[E api.Object] interface {
	Handle(event Event[E])
}

type HandlerFunc

type HandlerFunc[E api.Object] func(event Event[E])

func (HandlerFunc[E]) Handle

func (f HandlerFunc[E]) Handle(event Event[E])

type HandlerRegistration

type HandlerRegistration interface{}

type ListWatchSource

type ListWatchSource[E api.Object] struct {
	// contains filtered or unexported fields
}

func NewListWatchSource

func NewListWatchSource[E api.Object](listFunc func(ctx context.Context) ([]E, error), watchFunc func(ctx context.Context) (store.Watch[E], error), opts ListWatchSourceOptions) (*ListWatchSource[E], error)

func (*ListWatchSource[E]) AddHandler

func (s *ListWatchSource[E]) AddHandler(handler Handler[E]) (HandlerRegistration, error)

func (*ListWatchSource[E]) RemoveHandler

func (s *ListWatchSource[E]) RemoveHandler(registration HandlerRegistration) error

func (*ListWatchSource[E]) Start

func (s *ListWatchSource[E]) Start(ctx context.Context) error

type ListWatchSourceOptions

type ListWatchSourceOptions struct {
	ResyncDuration time.Duration
}

type Source

type Source[E api.Object] interface {
	AddHandler(handler Handler[E]) (HandlerRegistration, error)
	RemoveHandler(registration HandlerRegistration) error
}

type Type

type Type string
const (
	TypeCreated Type = "Created"
	TypeUpdated Type = "Updated"
	TypeDeleted Type = "Deleted"
	TypeGeneric Type = "Generic"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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