Documentation ¶
Index ¶
- Variables
- func ReadCharmURL(d *GitDir) (*charm.URL, error)
- func WriteCharmURL(d *GitDir, url *charm.URL) error
- type BundleInfo
- type BundleReader
- type BundlesDir
- type Deployer
- type GitDir
- func (d *GitDir) AddAll() error
- func (d *GitDir) Clone(path string) (*GitDir, error)
- func (d *GitDir) Commitf(format string, args ...interface{}) error
- func (d *GitDir) Conflicted() (bool, error)
- func (d *GitDir) Dirty() (bool, error)
- func (d *GitDir) Exists() (bool, error)
- func (d *GitDir) Init() error
- func (d *GitDir) Log() ([]string, error)
- func (d *GitDir) Path() string
- func (d *GitDir) Pull(src *GitDir) error
- func (d *GitDir) Revert() error
- func (d *GitDir) Snapshotf(format string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ErrConflict = errors.New("charm upgrade has conflicts")
Functions ¶
func ReadCharmURL ¶
ReadCharmURL reads the charm identity file from the supplied GitDir.
Types ¶
type BundleInfo ¶
type BundleInfo interface { URL() *charm.URL ArchiveURL() (*url.URL, bool, error) ArchiveSha256() (string, error) }
BundleInfo holds bundle information for a charm.
type BundleReader ¶
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{}) (*charm.Bundle, error) }
BundleReader primarily exists to make BundlesDir mockable.
type BundlesDir ¶
type BundlesDir struct {
// contains filtered or unexported fields
}
BundlesDir is responsible for storing and retrieving charm bundles identified by state charms.
func NewBundlesDir ¶
func NewBundlesDir(path string) *BundlesDir
NewBundlesDir returns a new BundlesDir which uses path for storage.
func (*BundlesDir) Read ¶
func (d *BundlesDir) Read(info BundleInfo, abort <-chan struct{}) (*charm.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 ¶
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. Deploy() error // NotifyRevert must be called when a conflicted deploy is abandoned, in // preparation for a new upgrade. NotifyRevert() error // NotifyResolved must be called when the cause of a deploy conflict has // been resolved, and a new deploy attempt will be made. NotifyResolved() error }
Deployer is responsible for installing and upgrading charms.
func NewGitDeployer ¶
func NewGitDeployer(charmPath, dataPath string, bundles BundleReader) Deployer
NewGitDeployer creates a new Deployer which stores its state in dataPath, and installs or upgrades the charm at charmPath.
type GitDir ¶
type GitDir struct {
// contains filtered or unexported fields
}
GitDir exposes a specialized subset of git operations on a directory.
func (*GitDir) AddAll ¶
AddAll ensures that the next commit will reflect the current contents of the directory. Empty directories will be preserved by inserting and tracking empty files named .empty.
func (*GitDir) Clone ¶
Clone creates a new GitDir at the specified path, with history cloned from the existing GitDir. It does not check out any files.
func (*GitDir) Commitf ¶
Commitf commits a new revision to the repository with the supplied message.
func (*GitDir) Conflicted ¶
Conflicted returns true if the directory contains any conflicts.