Documentation
¶
Index ¶
- type Backoff
- type Child
- type CommandStarter
- type HealthChecker
- type Observation
- type Options
- type Starter
- type Status
- type Supervisor
- func (s *Supervisor) Maintain(ctx context.Context, work func() error) error
- func (s *Supervisor) Reinstall(ctx context.Context, work func(*UpdateSession) error) error
- func (s *Supervisor) Restart(ctx context.Context) error
- func (s *Supervisor) Run(ctx context.Context) (resultErr error)
- func (s *Supervisor) Update(ctx context.Context, work func(*UpdateSession) error) error
- func (s *Supervisor) WaitForCore()
- type UpdateSession
- type Waiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandStarter ¶
type CommandStarter struct {
ShareProcessGroup bool
// CommandFactory binds installed provenance and committed config for root mode.
// The returned release closes capabilities after Start, including failure.
CommandFactory func(context.Context) (core.CoreCommand, func() error, error)
BinaryPath string
DataDir string
ConfigPath string
Stdout io.Writer
Stderr io.Writer
}
func (CommandStarter) Start ¶
func (s CommandStarter) Start() (Child, error)
func (CommandStarter) StartContext ¶ added in v0.9.6
func (s CommandStarter) StartContext(ctx context.Context) (Child, error)
StartContext preserves the owner's execution capability through OS Start.
type HealthChecker ¶
type Observation ¶
type Options ¶
type Options struct {
Starter Starter
// BeforeStart prepares each child and returns ownership held until Start completes.
BeforeStart func(context.Context) (release func(), err error)
Health HealthChecker
Waiter Waiter
Now func() time.Time
Observe func(Observation)
MinimumBackoff time.Duration
MaximumBackoff time.Duration
StableAfter time.Duration
GracePeriod time.Duration
HealthInterval time.Duration
StopTimeout time.Duration
DiagnosticReporter diagnostics.Reporter
}
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
func New ¶
func New(options Options) *Supervisor
func (*Supervisor) Maintain ¶ added in v0.9.3
func (s *Supervisor) Maintain(ctx context.Context, work func() error) error
Maintain runs work only while the owned child and monitor are stopped. Work must not call supervisor methods. Once accepted, cancellation does not detach work: the caller waits until commit/recovery has converged. Idle maintenance preserves the stopped state and never starts a process.
func (*Supervisor) Reinstall ¶ added in v0.9.6
func (s *Supervisor) Reinstall(ctx context.Context, work func(*UpdateSession) error) error
Reinstall admits one explicit candidate installation while ordinary starts are blocked.
func (*Supervisor) Update ¶ added in v0.9.6
func (s *Supervisor) Update(ctx context.Context, work func(*UpdateSession) error) error
Update serializes one complete core update, including trial and recovery.
func (*Supervisor) WaitForCore ¶ added in v0.9.6
func (s *Supervisor) WaitForCore()
WaitForCore starts the event loop without trying to execute a missing binary. Runtime assembly invokes it before Run for an initial installation.
type UpdateSession ¶ added in v0.9.6
type UpdateSession struct {
// contains filtered or unexported fields
}
UpdateSession owns trial processes while ordinary restart and monitoring pause.
func (*UpdateSession) KeepStopped ¶ added in v0.9.6
func (s *UpdateSession) KeepStopped()
KeepStopped preserves a stopped or missing original core after recovery.
func (*UpdateSession) PID ¶ added in v0.9.6
func (s *UpdateSession) PID() int
PID reports the owned trial or restored process, or zero when stopped.
func (*UpdateSession) Start ¶ added in v0.9.6
func (s *UpdateSession) Start(ctx context.Context) error
Start starts one process and waits for its initial health confirmation.
func (*UpdateSession) StartedAt ¶ added in v0.9.6
func (s *UpdateSession) StartedAt() time.Time
StartedAt is the actual start of the currently owned process.
func (*UpdateSession) Stop ¶ added in v0.9.6
func (s *UpdateSession) Stop() error
Stop joins the current trial process before files may be replaced again.
func (*UpdateSession) WasRunning ¶ added in v0.9.6
func (s *UpdateSession) WasRunning() bool
WasRunning reports whether the maintenance session replaced running intent.