Documentation ¶
Overview ¶
Package overlord implements the overall control of a snappy system.
Index ¶
- type Overlord
- func (o *Overlord) AssertManager() *assertstate.AssertManager
- func (o *Overlord) DeviceManager() *devicestate.DeviceManager
- func (o *Overlord) HookManager() *hookstate.HookManager
- func (o *Overlord) InterfaceManager() *ifacestate.InterfaceManager
- func (o *Overlord) Loop()
- func (o *Overlord) SetRestartHandler(handleRestart func(t state.RestartType))
- func (o *Overlord) Settle() error
- func (o *Overlord) SnapManager() *snapstate.SnapManager
- func (o *Overlord) State() *state.State
- func (o *Overlord) Stop() error
- type StateEngine
- type StateManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Overlord ¶
type Overlord struct {
// contains filtered or unexported fields
}
Overlord is the central manager of a snappy system, keeping track of all available state managers and related helpers.
func (*Overlord) AssertManager ¶
func (o *Overlord) AssertManager() *assertstate.AssertManager
AssertManager returns the assertion manager enforcing assertions under the overlord.
func (*Overlord) DeviceManager ¶
func (o *Overlord) DeviceManager() *devicestate.DeviceManager
DeviceManager returns the device manager responsible for the device identity and policies
func (*Overlord) HookManager ¶
func (o *Overlord) HookManager() *hookstate.HookManager
HookManager returns the hook manager responsible for running hooks under the overlord.
func (*Overlord) InterfaceManager ¶
func (o *Overlord) InterfaceManager() *ifacestate.InterfaceManager
InterfaceManager returns the interface manager maintaining interface connections under the overlord.
func (*Overlord) Loop ¶
func (o *Overlord) Loop()
Loop runs a loop in a goroutine to ensure the current state regularly through StateEngine Ensure.
func (*Overlord) SetRestartHandler ¶
func (o *Overlord) SetRestartHandler(handleRestart func(t state.RestartType))
SetRestartHandler sets a handler to fulfill restart requests asynchronously.
func (*Overlord) Settle ¶
Settle runs first a state engine Ensure and then wait for activities to settle. That's done by waiting for all managers activities to settle while making sure no immediate further Ensure is scheduled. Chiefly for tests. Cannot be used in conjunction with Loop.
func (*Overlord) SnapManager ¶
func (o *Overlord) SnapManager() *snapstate.SnapManager
SnapManager returns the snap manager responsible for snaps under the overlord.
type StateEngine ¶
type StateEngine struct {
// contains filtered or unexported fields
}
StateEngine controls the dispatching of state changes to state managers.
Most of the actual work performed by the state engine is in fact done by the individual managers registered. These managers must be able to cope with Ensure calls in any order, coordinating among themselves solely via the state.
func NewStateEngine ¶
func NewStateEngine(s *state.State) *StateEngine
NewStateEngine returns a new state engine.
func (*StateEngine) AddManager ¶
func (se *StateEngine) AddManager(m StateManager)
AddManager adds the provided manager to take part in state operations.
func (*StateEngine) Ensure ¶
func (se *StateEngine) Ensure() error
Ensure asks every manager to ensure that they are doing the necessary work to put the current desired system state in place by calling their respective Ensure methods.
Managers must evaluate the desired state completely when they receive that request, and report whether they found any critical issues. They must not perform long running activities during that operation, though. These should be performed in properly tracked changes and tasks.
func (*StateEngine) State ¶
func (se *StateEngine) State() *state.State
State returns the current system state.
func (*StateEngine) Stop ¶
func (se *StateEngine) Stop()
Stop asks all managers to terminate activities running concurrently.
func (*StateEngine) Wait ¶
func (se *StateEngine) Wait()
Wait waits for all managers current activities.
type StateManager ¶
type StateManager interface { // Ensure forces a complete evaluation of the current state. // See StateEngine.Ensure for more details. Ensure() error // Wait asks manager to wait for all running activities to finish. Wait() // Stop asks the manager to terminate all activities running concurrently. // It must not return before these activities are finished. Stop() }
StateManager is implemented by types responsible for observing the system and manipulating it to reflect the desired state.
Directories ¶
Path | Synopsis |
---|---|
Package assertstate implements the manager and state aspects responsible for the enforcement of assertions in the system and manages the system-wide assertion database.
|
Package assertstate implements the manager and state aspects responsible for the enforcement of assertions in the system and manages the system-wide assertion database. |
Package configstate implements the manager and state aspects responsible for the configuration of snaps.
|
Package configstate implements the manager and state aspects responsible for the configuration of snaps. |
Package devicestate implements the manager and state aspects responsible for the device identity and policies.
|
Package devicestate implements the manager and state aspects responsible for the device identity and policies. |
Package hookstate implements the manager and state aspects responsible for the running of hooks.
|
Package hookstate implements the manager and state aspects responsible for the running of hooks. |
ctlcmd
Package ctlcmd contains the various snapctl subcommands.
|
Package ctlcmd contains the various snapctl subcommands. |
Package ifacestate implements the manager and state aspects responsible for the maintenance of interfaces the system.
|
Package ifacestate implements the manager and state aspects responsible for the maintenance of interfaces the system. |
Package snapstate implements the manager and state aspects responsible for the installation and removal of snaps.
|
Package snapstate implements the manager and state aspects responsible for the installation and removal of snaps. |
backend
Package backend implements the low-level primitives to manage the snaps and their installation on disk.
|
Package backend implements the low-level primitives to manage the snaps and their installation on disk. |
Package state implements the representation of system state.
|
Package state implements the representation of system state. |