caasunitterminationworker

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 13 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
	Clock          clock.Clock
}

type Logger

type Logger interface {
	Infof(string, ...interface{})
	Errorf(string, ...interface{})
}

Logger for logging messages.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string
	UniterName    string
	Clock         clock.Clock
	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(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