sequence

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: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Coo is the optional amount of time that this sequence worker engine
	// specifies to wait before being executed again. This cooler duration is not
	// an interval on a strict schedule. This is simply the time to sleep after
	// execution, before another cycle repeats. Note that Worker.Daemon is
	// explicitly disabled if Coo is not provided. Regardless, Worker.Ensure may
	// be used on demand even without specified cooler duration.
	Coo time.Duration

	// Han is the list of worker handlers implementing the actual business logic
	// as a directed acyclic graph. The worker handlers configured here may be
	// wrapped in administrative handler implementations to e.g. instrument
	// handler execution latency and handler error rates. All worker handlers
	// provided here will be executed sequentially within the same failure domain.
	Han [][]handler.Ensure

	// Log is a standard logger interface to forward structured log messages to
	// any output interface e.g. stdout.
	Log logger.Interface

	// Reg is the metrics interface used to wrap the internally managed handlers
	// for instrumentation purposes. The metrics handlers created by this registry
	// will record all worker handler execution metrics.
	Reg *registry.Registry
}

type Worker

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

func New

func New(c Config) *Worker

func (*Worker) Daemon

func (w *Worker) Daemon()

func (*Worker) Ensure

func (w *Worker) Ensure() error

Ensure executes a single reconciliation loop of the directed acyclic graph. This method is exposed publicly so that not only Worker.Daemon can run this sequence of worker handlers continuously, but also to enable users to run this sequence once in a controlled fashion.

Jump to

Keyboard shortcuts

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