Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCharmAlreadyStoredError ¶
NewCharmAlreadyStoredError creates an error that indicates that a charm has already been stored.
Types ¶
type CharmArchive ¶
type CharmArchive interface { corecharm.CharmArchive }
CharmArchive provides information about a downloaded charm archive.
type CharmRepository ¶
type CharmRepository interface { GetDownloadURL(string, corecharm.Origin) (*url.URL, corecharm.Origin, error) ResolveWithPreferredChannel(charmName string, requestedOrigin corecharm.Origin) (*charm.URL, corecharm.Origin, []corecharm.Platform, error) DownloadCharm(charmName string, requestedOrigin corecharm.Origin, archivePath string) (corecharm.CharmArchive, corecharm.Origin, error) }
CharmRepository provides an API for downloading charms/bundles.
type DownloadedCharm ¶
type DownloadedCharm struct { // Charm provides information about the charm contents. Charm charm.Charm // The charm version. CharmVersion string // CharmData provides byte-level access to the downloaded charm data. CharmData io.Reader // The Size of the charm data in bytes. Size int64 // SHA256 is the hash of the bytes in Data. SHA256 string // The LXD profile or nil if no profile specified by the charm. LXDProfile *charm.LXDProfile }
DownloadedCharm encapsulates the details of a downloaded charm.
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader implements store-agnostic download and pesistence of charm blobs.
func NewDownloader ¶
func NewDownloader(logger Logger, storage Storage, repoGetter RepositoryGetter) *Downloader
NewDownloader returns a new charm downloader instance.
func (*Downloader) DownloadAndStore ¶
func (d *Downloader) DownloadAndStore(charmURL *charm.URL, requestedOrigin corecharm.Origin, force bool) (corecharm.Origin, error)
DownloadAndStore looks up the requested charm using the appropriate store, downloads it to a temporary file and passes it to the configured storage API so it can be persisted.
The method ensures that all temporary resources are cleaned up before returning.
type Logger ¶
type Logger interface { Tracef(string, ...interface{}) Debugf(string, ...interface{}) Warningf(string, ...interface{}) }
Logger defines the logging methods that the package uses.
type RepositoryGetter ¶
type RepositoryGetter interface {
GetCharmRepository(corecharm.Source) (CharmRepository, error)
}
RepositoryGetter returns a suitable CharmRepository for the specified Source.