handler

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Name

func Name(h Ensure) string

Name returns the package declaration of the given handler implementation.

func Names

func Names(han []Ensure) []string

Names returns the list of worker handler names matching the given list of worker handler interfaces. E.g. this function should enable the metrics registry to whitelist all injected worker handlers automatically.

Types

type Active added in v0.7.0

type Active interface {
	// Active returns the underlying worker handler implementation is supposed to
	// be executed during reconciliation. This might be useful to disable certain
	// worker handlers for e.g. specific environments.
	Active() bool
}

Active is a scheduler primitive that allows worker handlers to be disabled for arbitrary conditions.

type Cooler added in v0.5.0

type Cooler interface {
	// Cooler is the amount of time that any given handler specifies to wait
	// before being executed again. This is not an interval on a strict schedule.
	// This is simply the time to sleep after execution, before another cycle
	// repeats.
	Cooler() time.Duration
	Ensure
}

Cooler is manadatory to be implemented for worker handlers executed by the *parallel.Worker engine, because those worker handlers do all run inside their own isolated failure domains, which require individual cooler durations to be provided. Cooler is irrelevant for the worker handlers executed by the *sequence.Worker engine, because those handlers run inside a single pipeline with a cooler duration congiured on the engine level.

type Ensure added in v0.5.0

type Ensure interface {
	Active
	// Ensure executes the handler specific business logic in order to complete
	// the given task, if possible. Any error returned will be emitted using the
	// underlying logger interface, unless the injected metrics registry is
	// configured to filter the received error.
	Ensure() error
}

Ensure is the minimal worker handler interface that all users have to implement for their own business logic, regardless of the underlying worker engine.

type Interface

type Interface interface {
	Cooler
	Ensure
	Unwrap
}

Interface describes the internally wrapped worker handlers used for proper management inside of the various worker engines. External users do usually not have to be concerned with this entire interface.

type Unwrap added in v0.5.0

type Unwrap interface {
	// Unwrap returns the underlying worker handler implementation, if any.
	Unwrap() Ensure
}

Unwrap is an administrative interface that is most useful for our internal wrapper handlers, e.g. metrics and proxy. Most users do not have to worry about this.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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