threads

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 7 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 is a struct that holds configuration to manage concurrent RunnableThreads

func NewManager

func NewManager() Manager

NewManager returns a new initialized Manager struct

func (*Manager) CleanupThreads

func (mgr *Manager) CleanupThreads(owner client.Object) func(context.Context, client.Client) error

CleanupThreads returns a function that cleans matching threads when invoked. This is intended for use as a cleanup function in the finalize phase of a controller's reconcile loop.

func (*Manager) GetChannel

func (mgr *Manager) GetChannel() <-chan event.GenericEvent

GetChannel returns the channel through which events can be received from the running thread

func (*Manager) GetKeys

func (mgr *Manager) GetKeys() []string

func (*Manager) GetThread

func (mgr *Manager) GetThread(id string, owner client.Object, log logr.Logger) RunnableThread

Returns a thread, typically for inspection by the caller (ie get status/errors)

func (*Manager) ReconcileThreads

func (mgr *Manager) ReconcileThreads(ctx context.Context, owner client.Object, threads []RunnableThread, log logr.Logger) error

ReconcileThreads ensures that the threads identified by the provided keys are running. prefix() is used to identify which threads belong to each resource.

type RunnableThread

type RunnableThread interface {
	GetID() string
	SetChannel(chan event.GenericEvent)
	Start(context.Context, logr.Logger) error
	Stop()
	IsStarted() bool
	CanBeDeleted() bool
}

Jump to

Keyboard shortcuts

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