upgrader

package
v0.0.0-...-12adbad Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 23 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedTargetVersion

func AllowedTargetVersion(
	curVersion version.Number,
	targetVersion version.Number,
) bool

AllowedTargetVersion checks if targetVersion is too different from curVersion to allow a downgrade.

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs an upgrader worker, using the resource names defined in the supplied config.

Types

type Clock

type Clock interface {
	After(time.Duration) <-chan time.Time
}

Clock represents the clock methods this worker uses.

type Config

type Config struct {
	Clock                       Clock
	Logger                      Logger
	State                       *upgrader.State
	AgentConfig                 agent.Config
	OrigAgentVersion            version.Number
	UpgradeStepsWaiter          gate.Waiter
	InitialUpgradeCheckComplete gate.Unlocker
	CheckDiskSpace              func(string, uint64) error
}

Config contains the items the worker needs to start.

type Logger

type Logger interface {
	Debugf(string, ...interface{})
	Infof(string, ...interface{})
	Errorf(string, ...interface{})
}

Logger represents the logging methods used by this package.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName            string
	APICallerName        string
	UpgradeStepsGateName string
	UpgradeCheckGateName string
	PreviousAgentVersion version.Number
	Logger               Logger
	Clock                Clock
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

type Upgrader

type Upgrader struct {
	// contains filtered or unexported fields
}

Upgrader represents a worker that watches the state for upgrade requests.

func NewAgentUpgrader

func NewAgentUpgrader(config Config) (*Upgrader, error)

NewAgentUpgrader returns a new upgrader worker. It watches changes to the current version of the current agent (with the given tag) and tries to download the tools for any new version into the given data directory. If an upgrade is needed, the worker will exit with an UpgradeReadyError holding details of the requested upgrade. The tools will have been downloaded and unpacked.

func (*Upgrader) Kill

func (u *Upgrader) Kill()

Kill implements worker.Worker.Kill.

func (*Upgrader) Wait

func (u *Upgrader) Wait() error

Wait implements worker.Worker.Wait.

Jump to

Keyboard shortcuts

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