upgrader

package
v0.0.0-...-4308112 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

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 Config

type Config struct {
	Clock                       clock.Clock
	Logger                      logger.Logger
	Client                      UpgraderClient
	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 ManifoldConfig

type ManifoldConfig struct {
	AgentName            string
	APICallerName        string
	UpgradeStepsGateName string
	UpgradeCheckGateName string
	PreviousAgentVersion version.Number
	Logger               logger.Logger
	Clock                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.

type UpgraderClient

type UpgraderClient interface {
	DesiredVersion(ctx context.Context, tag string) (version.Number, error)
	SetVersion(ctx context.Context, tag string, v version.Binary) error
	WatchAPIVersion(ctx context.Context, agentTag string) (watcher.NotifyWatcher, error)
	Tools(ctx context.Context, tag string) (coretools.List, error)
}

UpgraderClient provides the facade methods used by the worker.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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