Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency manifold that runs an upgrade-series worker, using the resource names defined in the supplied config.
Types ¶
type Config ¶
type Config struct {
// Facade is used to access back-end state.
Facade Facade
// Logger is the logger for this worker.
Logger Logger
// UnitDiscovery determines how the worker knows which units should
// be running on the machine.
UnitDiscovery UnitDiscovery
// UpgraderFactory is a factory method that will return an upgrader capable
// of handling service and agent binary manipulation for a
// runtime-determined current and target OS series.
UpgraderFactory func(string, string) (Upgrader, error)
}
Config is the configuration needed to construct an UpgradeSeries worker.
type Facade ¶
type Facade interface {
// Getters
WatchUpgradeSeriesNotifications() (watcher.NotifyWatcher, error)
MachineStatus() (model.UpgradeSeriesStatus, error)
UnitsPrepared() ([]names.UnitTag, error)
UnitsCompleted() ([]names.UnitTag, error)
CurrentSeries() (string, error)
TargetSeries() (string, error)
// Setters
StartUnitCompletion(reason string) error
SetMachineStatus(status model.UpgradeSeriesStatus, reason string) error
FinishUpgradeSeries(string) error
PinMachineApplications() (map[string]error, error)
UnpinMachineApplications() (map[string]error, error)
SetInstanceStatus(model.UpgradeSeriesStatus, string) error
}
Facade exposes the API surface required by the upgrade-series worker.
type Logger ¶
type Logger interface {
Debugf(message string, args ...interface{})
Infof(message string, args ...interface{})
Warningf(message string, args ...interface{})
Errorf(message string, args ...interface{})
}
Logger represents the methods required to emit log messages.
type ManifoldConfig ¶
type ManifoldConfig struct {
AgentName string
APICallerName string
Logger Logger
NewFacade func(base.APICaller, names.Tag) Facade
NewWorker func(Config) (worker.Worker, error)
}
ManifoldConfig holds the information necessary for the dependency engine to to run an upgrade-series worker.
func (ManifoldConfig) Validate ¶
func (config ManifoldConfig) Validate() error
Validate validates the manifold configuration.
type UnitDiscovery ¶
UnitDiscovery represents how the worker determines which units need to check in.
type Upgrader ¶
type Upgrader interface {
PerformUpgrade() error
}
Upgrader describes methods required to perform file-system manipulation in preparation for upgrading the host Ubuntu version.
func NewUpgrader ¶
func NewUpgrader( currentSeries, toSeries string, manager service.SystemdServiceManager, logger Logger, ) (Upgrader, error)
NewUpgrader uses the input function to determine the series that should be supported, and returns a reference to a new Upgrader that supports it.