overlord

package
v0.0.0-...-1400bc0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2016 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package overlord implements the overall control of a snappy system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstBoot

func FirstBoot() error

FIXME: This is not the final way we will do the state sync. This is just an intermediate step to have working images again. We need to figure out how we want first-boot to look like.

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 New

func New() (*Overlord, error)

New creates a new Overlord with all its state managers.

func (*Overlord) AssertManager

func (o *Overlord) AssertManager() *assertstate.AssertManager

AssertManager returns the assertion manager enforcing assertions 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) Settle

func (o *Overlord) Settle() error

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.

func (*Overlord) State

func (o *Overlord) State() *state.State

State returns the system state managed by the overlord.

func (*Overlord) Stop

func (o *Overlord) Stop() error

Stop stops the ensure loop and the managers under the StateEngine.

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.
Package assertstate implements the manager and state aspects responsible for the enforcement of assertions in the system.
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.

Jump to

Keyboard shortcuts

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