juju: github.com/juju/juju/worker/uniter/charm Index | Files

package charm

import "github.com/juju/juju/worker/uniter/charm"

Index

Package Files

bundles.go charm.go converter.go manifest_deployer.go

Constants

const CharmURLPath = ".juju-charm"

CharmURLPath is the path within a charm directory to which Deployers commonly write the charm URL of the latest deployed charm.

Variables

var ErrConflict = errors.New("charm upgrade has conflicts")

ErrConflict indicates that an upgrade failed and cannot be resolved without human intervention.

var NewDeployer = newDeployer

NewDeployer returns a manifest deployer. It is a var so that it can be patched for uniter tests.

func ClearDownloads Uses

func ClearDownloads(bundlesDir string) error

ClearDownloads removes any entries in the temporary bundle download directory. It is intended to be called on uniter startup.

func ReadCharmURL Uses

func ReadCharmURL(path string) (*charm.URL, error)

ReadCharmURL reads a charm identity file from the supplied path.

func WriteCharmURL Uses

func WriteCharmURL(path string, url *charm.URL) error

WriteCharmURL writes a charm identity file into the supplied path.

type Bundle Uses

type Bundle interface {

    // Manifest returns a set of slash-separated strings representing files,
    // directories, and symlinks stored in the bundle.
    Manifest() (set.Strings, error)

    // ExpandTo unpacks the entities referenced in the manifest into the
    // supplied directory. If it returns without error, every file referenced
    // in the charm must be present in the directory; implementations may vary
    // in the details of what they do with other files present.
    ExpandTo(dir string) error
}

Bundle allows access to a charm's files.

type BundleInfo Uses

type BundleInfo interface {

    // URL returns the charm URL identifying the bundle.
    URL() *charm.URL

    // ArchiveSha256 returns the hex-encoded SHA-256 digest of the bundle data.
    ArchiveSha256() (string, error)
}

BundleInfo describes a Bundle.

type BundleReader Uses

type BundleReader interface {

    // Read returns the bundle identified by the supplied info. The abort chan
    // can be used to notify an implementation that it need not complete the
    // operation, and can immediately error out if it is convenient to do so.
    Read(bi BundleInfo, abort <-chan struct{}) (Bundle, error)
}

BundleReader provides a mechanism for getting a Bundle from a BundleInfo.

type BundlesDir Uses

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

BundlesDir is responsible for storing and retrieving charm bundles identified by state charms.

func NewBundlesDir Uses

func NewBundlesDir(path string, dlr Downloader) *BundlesDir

NewBundlesDir returns a new BundlesDir which uses path for storage.

func (*BundlesDir) Read Uses

func (d *BundlesDir) Read(info BundleInfo, abort <-chan struct{}) (Bundle, error)

Read returns a charm bundle from the directory. If no bundle exists yet, one will be downloaded and validated and copied into the directory before being returned. Downloads will be aborted if a value is received on abort.

type Deployer Uses

type Deployer interface {

    // Stage must be called to prime the Deployer to install or upgrade the
    // bundle identified by the supplied info. The abort chan can be used to
    // notify an implementation that it need not complete the operation, and
    // can immediately error out if it convenient to do so. It must always
    // be safe to restage the same bundle, or to stage a new bundle.
    Stage(info BundleInfo, abort <-chan struct{}) error

    // Deploy will install or upgrade the most recently staged bundle.
    // Behaviour is undefined if Stage has not been called. Failures that
    // can be resolved by user intervention will be signalled by returning
    // ErrConflict.
    Deploy() error
}

Deployer is responsible for installing and upgrading charms.

func NewManifestDeployer Uses

func NewManifestDeployer(charmPath, dataPath string, bundles BundleReader) Deployer

NewManifestDeployer returns a Deployer that installs bundles from the supplied BundleReader into charmPath, and which reads and writes its persistent data into dataPath.

It works by always writing the full contents of a deployed charm; and, if another charm was previously deployed, deleting only those files unique to that base charm. It thus leaves user files in place, with the exception of those in directories referenced only in the original charm, which will be deleted.

type Downloader Uses

type Downloader interface {
    // Download starts a new charm archive download, waits for it to
    // complete, and returns the local name of the file.
    Download(req downloader.Request) (string, error)
}

Download exposes the downloader.Download methods needed here.

Package charm imports 12 packages (graph) and is imported by 85 packages. Updated 2018-10-29. Refresh now. Tools for package owners.