refresher

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExhausted = errors.Errorf("exhausted")

ErrExhausted reveals if a refresher was exhausted in it's task. If so, then it is expected to attempt another refresher.

Functions

This section is empty.

Types

type CharmID

type CharmID struct {
	URL      *charm.URL
	Origin   corecharm.Origin
	Macaroon *macaroon.Macaroon
}

CharmID represents a charm identifier.

type CharmRepository

type CharmRepository interface {
	// NewCharmAtPathForceSeries returns the charm represented by this path,
	// and a URL that describes it. If the series is empty,
	// the charm's default series is used, if any.
	// Otherwise, the series is validated against those the
	// charm declares it supports. If force is true, then any
	// series validation errors are ignored and the requested
	// series is used regardless. Note though that is it still
	// an error if the series is not specified and the charm does not
	// define any.
	NewCharmAtPathForceSeries(path, series string, force bool) (charm.Charm, *charm.URL, error)
}

CharmRepository defines methods for interaction with a charm repo.

type CharmResolver

type CharmResolver interface {
	ResolveCharm(url *charm.URL, preferredOrigin commoncharm.Origin, switchCharm bool) (*charm.URL, commoncharm.Origin, []string, error)
}

CharmResolver defines methods required to resolve charms, as required by the upgrade-charm command.

type CommandLogger

type CommandLogger interface {
	Infof(format string, params ...interface{})
	Warningf(format string, params ...interface{})
	Verbosef(format string, params ...interface{})
}

CommandLogger represents a logger which follows the logging precepts of a cmd.Context.

type Refresher

type Refresher interface {
	// Allowed will attempt to check if a refresher is allowed to run a given
	// config.
	Allowed(RefresherConfig) (bool, error)
	// Refresh a given charm. Bundles are not supported as there is no physical
	// representation in Juju.
	Refresh() (*CharmID, error)

	// String returns a string description of the refresher.
	String() string
}

Refresher defines the functionality of a refresher returned by the factory.

type RefresherConfig

type RefresherConfig struct {
	ApplicationName string
	CharmURL        *charm.URL
	CharmOrigin     corecharm.Origin
	CharmRef        string
	Channel         charm.Channel
	DeployedSeries  string
	Force           bool
	ForceSeries     bool
	Switch          bool
	Logger          CommandLogger
}

RefresherConfig is the data required to choose an refresher and then run the PrepareAndUpgrade.

type RefresherDependencies

type RefresherDependencies struct {
	Authorizer    store.MacaroonGetter
	CharmAdder    store.CharmAdder
	CharmResolver CharmResolver
}

RefresherDependencies are required for any deployer to be run.

type RefresherFactory

type RefresherFactory interface {
	Run(RefresherConfig) (*CharmID, error)
}

RefresherFactory contains a method to get a refresher.

func NewRefresherFactory

func NewRefresherFactory(deps RefresherDependencies) RefresherFactory

NewRefresherFactory returns a factory setup with the API and function dependencies required by every refresher.

type RefresherFn

type RefresherFn = func(RefresherConfig) (Refresher, error)

RefresherFn defines a function alias to create a Refresher from a given function.

type ResolveOriginFunc

type ResolveOriginFunc = func(*charm.URL, corecharm.Origin, charm.Channel) (commoncharm.Origin, error)

ResolveOriginFunc attempts to resolve a new charm Origin from the given arguments, ensuring that we work for multiple stores (charmhub vs charmstore)

Jump to

Keyboard shortcuts

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