Documentation
¶
Index ¶
Constants ¶
View Source
const ( StateInitializing = "initializing" StateInitialized = "initialized" StateStarting = "starting" StateRunning = "running" StateStopping = "stopping" StateStopped = "stopped" StateReloading = "reloading" StateRestarting = "restarting" StateError = "error" )
Variables ¶
View Source
var DepCtxKey = depCtxKey{}
DepCtxKey is used to store the call stack for cycle detection
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
GraceStop time.Duration
WaitStart time.Duration
WaitStop time.Duration
// contains filtered or unexported fields
}
func NewController ¶
func NewController(id, host string, r Runner, bus *TypedBus, deps DependencyResolver) *Controller
func (*Controller) Apply ¶
func (c *Controller) Apply(a Action) error
func (*Controller) ApplyWithContext ¶
func (c *Controller) ApplyWithContext(ctx context.Context, a Action) error
func (*Controller) State ¶
func (c *Controller) State() string
type DependencyResolver ¶
type LifecycleStateMachine ¶
type LifecycleStateMachine struct {
// contains filtered or unexported fields
}
func (*LifecycleStateMachine) CurrentProtoState ¶
func (lsm *LifecycleStateMachine) CurrentProtoState() protopkg.AgentState
func (*LifecycleStateMachine) GetState ¶
func (lsm *LifecycleStateMachine) GetState() string
func (*LifecycleStateMachine) TransitionTo ¶
func (lsm *LifecycleStateMachine) TransitionTo(newState string) error
type RunIDSetter ¶
type RunIDSetter interface {
SetRunID(string)
}
Optional capability for runners to support per-start correlation.
type Runner ¶
type Runner interface {
// Start spawns the runner's process. The context bounds the start
// operation only - it is cancelled as soon as Start returns, so an
// implementation must NOT tie the spawned process's lifetime to it.
// exec.CommandContext here means the process is SIGKILLed the moment
// the start call completes (GAPI-DIV-028); use exec.Command and let
// Stop own the process.
Start(ctx context.Context) error
Stop(ctx context.Context) error
Reload(ctx context.Context) error
Reset()
}
Click to show internal directories.
Click to hide internal directories.