supervisor

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 15 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 interface {
	// business
	model.Supervisor
	// health.go: Alive fails only when in-process recovery is spent (a
	// service dead with restarts exhausted) - the signal to let the platform
	// replace the process. Ready is the roll-up: nil iff every registered
	// service is ready. Both judge from cached stats; probing stays the
	// monitor's job.
	common.Liveness
	common.Readiness
	// lifecycle
	common.Initializable
	common.Daemon
	common.Debuggable
}

func New

func New(config *viper.Viper, opts ...Option) Manager

type Option

type Option func(*manager)

func WithInitPolicy added in v0.6.9

func WithInitPolicy(maxRetries int, delay, maxDelay time.Duration) Option

WithInitPolicy sets how a service's init turn retries - waiting on dependencies to become ready, or re-running its own failed Init. maxRetries bounds the attempts: 0 disables retries (a single pass, the default), n > 0 allows n retries after the first attempt, -1 retries until the Init context is canceled. The wait between attempts starts at delay (1s when unset), doubles per attempt, and caps at maxDelay; when maxDelay <= delay the wait stays fixed.

func WithLogger

func WithLogger(logger log.Logger) Option

func WithMonitorPolicy added in v0.6.9

func WithMonitorPolicy(interval time.Duration, maxRetries int, restartDelay time.Duration) Option

WithMonitorPolicy sets the health monitor's shape: interval is the sweep cadence (0, the default, disables monitoring), maxRetries bounds in-process restarts per service (0 none - a liveness failure escalates immediately, n up to n, -1 unlimited), and restartDelay pauses before each restart attempt.

func WithName

func WithName(name string) Option

func WithStopPolicy added in v0.6.9

func WithStopPolicy(timeout time.Duration) Option

WithStopPolicy sets how Stop ends: timeout bounds the whole shutdown, 0 (the default) waits indefinitely.

Jump to

Keyboard shortcuts

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