juju: github.com/juju/juju/worker/upgradeseries Index | Files | Directories

package upgradeseries

import "github.com/juju/juju/worker/upgradeseries"

Index

Package Files

manifold.go shim.go upgrader.go worker.go

func Manifold Uses

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.

func NewWorker Uses

func NewWorker(config Config) (worker.Worker, error)

NewWorker creates, starts and returns a new upgrade-series worker based on the input configuration.

type Config Uses

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.

func (Config) Validate Uses

func (config Config) Validate() error

Validate validates the upgrade-series worker configuration.

type Facade Uses

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.

func NewFacade Uses

func NewFacade(apiCaller base.APICaller, tag names.Tag) Facade

NewFacade creates a new upgrade-series client and returns its reference as the facade indirection above.

type Logger Uses

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 Uses

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 Uses

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type UnitDiscovery Uses

type UnitDiscovery interface {
    Units() ([]names.UnitTag, error)
}

UnitDiscovery represents how the worker determines which units need to check in.

type Upgrader Uses

type Upgrader interface {
    PerformUpgrade() error
}

Upgrader describes methods required to perform file-system manipulation in preparation for upgrading the host Ubuntu version.

func NewUpgrader Uses

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.

Directories

PathSynopsis
mocksPackage mocks is a generated GoMock package.

Package upgradeseries imports 19 packages (graph) and is imported by 8 packages. Updated 2020-08-13. Refresh now. Tools for package owners.