refresher

package
v0.0.0-...-ea3e8b0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyUpToDate = errors.Errorf("already up-to-date")

ErrAlreadyUpToDate indicates a charm is already up-to-date.

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

func IsLocalURL

func IsLocalURL(url string) bool

IsLocalURL checks if the provided URL refers to a local charm (i.e. it begins with one of `/` `./` `../` ).

Types

type CharmID

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

CharmID represents a charm identifier.

type CharmRepository

type CharmRepository interface {
	// NewCharmAtPathForceBase returns the charm represented by this path,
	// and a URL that describes it. If the base is empty,
	// the charm's default base is used, if any.
	// Otherwise, the base is validated against those the
	// charm declares it supports. If force is true, then any
	// base validation errors are ignored and the requested
	// base is used regardless.
	NewCharmAtPathForceBase(path string, base base.Base, 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, []base.Base, 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
	Force           bool
	ForceBase       bool
	Switch          bool
	Logger          CommandLogger
}

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

type RefresherDependencies

type RefresherDependencies struct {
	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

Jump to

Keyboard shortcuts

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