executor

package
v2.20.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package executor contains a task executor / scheduler for the constellation node operator. It is used to execute tasks (outside of the k8s specific operator controllers) with regular intervals and based of external triggers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PollingFrequency time.Duration
	RateLimiter      RateLimiter
}

Config is the configuration for the executor.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates a new default configuration.

type Controller

type Controller interface {
	Reconcile(ctx context.Context) (Result, error)
}

Controller is a type with a reconcile method. It is modeled after the controller-runtime reconcile method, but reconciles on external resources instead of k8s resources.

type Executor

type Executor interface {
	Start(ctx context.Context) StopWaitFn
	Running() bool
	Trigger()
}

Executor is a task executor / scheduler.

func New

func New(controller Controller, cfg Config) Executor

New creates a new Executor.

type RateLimiter

type RateLimiter interface {
	// When gets an item and gets to decide how long that item should wait
	When(item any) time.Duration
	// Forget indicates that an item is finished being retried.  Doesn't matter whether its for perm failing
	// or for success, we'll stop tracking it
	Forget(item any)
}

RateLimiter is a stripped down version of the controller-runtime ratelimiter.RateLimiter interface.

type Result

type Result struct {
	Requeue      bool
	RequeueAfter time.Duration
}

Result is the result of a reconciliation.

type StopWaitFn

type StopWaitFn func()

StopWaitFn is a function that can be called to stop the executor and wait for it to stop.

Jump to

Keyboard shortcuts

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