caasunitterminationworker

package
v0.0.0-...-4308112 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TerminationSignal = syscall.SIGTERM

TerminationSignal is SIGTERM which is sent by most container runtimes when a container should terminate gracefully.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a manifold whose worker returns ErrTerminateAgent if a termination signal is received by the process it's running in.

func NewWorker

func NewWorker(config Config) worker.Worker

NewWorker returns a worker that waits for a TerminationSignal signal, and then exits with worker.ErrTerminateAgent.

Types

type Config

type Config struct {
	Agent          agent.Agent
	State          State
	UnitTerminator UnitTerminator
	Logger         logger.Logger
	Clock          clock.Clock
}

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string
	UniterName    string
	Clock         clock.Clock
	Logger        logger.Logger
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

func (*ManifoldConfig) Validate

func (config *ManifoldConfig) Validate() error

Validate ensures all the required values for the config are set.

type State

type State interface {
	UnitTerminating(ctx context.Context, tag names.UnitTag) (caasapplication.UnitTermination, error)
}

type UnitTerminator

type UnitTerminator interface {
	Terminate() error
}

Jump to

Keyboard shortcuts

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