Documentation
¶
Overview ¶
Package downloader is a generated GoMock package.
Index ¶
- func NewCharmAlreadyStoredError(charmURL string) error
- type CharmArchive
- type CharmRepository
- type DownloadedCharm
- type Downloader
- type Logger
- type MockCharmArchive
- func (m *MockCharmArchive) Actions() *v9.Actions
- func (m *MockCharmArchive) Config() *v9.Config
- func (m *MockCharmArchive) EXPECT() *MockCharmArchiveMockRecorder
- func (m *MockCharmArchive) LXDProfile() *v9.LXDProfile
- func (m *MockCharmArchive) Manifest() *v9.Manifest
- func (m *MockCharmArchive) Meta() *v9.Meta
- func (m *MockCharmArchive) Metrics() *v9.Metrics
- func (m *MockCharmArchive) Revision() int
- func (m *MockCharmArchive) Version() string
- type MockCharmArchiveMockRecorder
- func (mr *MockCharmArchiveMockRecorder) Actions() *gomock.Call
- func (mr *MockCharmArchiveMockRecorder) Config() *gomock.Call
- func (mr *MockCharmArchiveMockRecorder) LXDProfile() *gomock.Call
- func (mr *MockCharmArchiveMockRecorder) Manifest() *gomock.Call
- func (mr *MockCharmArchiveMockRecorder) Meta() *gomock.Call
- func (mr *MockCharmArchiveMockRecorder) Metrics() *gomock.Call
- func (mr *MockCharmArchiveMockRecorder) Revision() *gomock.Call
- func (mr *MockCharmArchiveMockRecorder) Version() *gomock.Call
- type MockCharmRepository
- func (m *MockCharmRepository) DownloadCharm(arg0 *v9.URL, arg1 charm.Origin, arg2 macaroon_v2.Slice, arg3 string) (charm.CharmArchive, charm.Origin, error)
- func (m *MockCharmRepository) EXPECT() *MockCharmRepositoryMockRecorder
- func (m *MockCharmRepository) GetDownloadURL(arg0 *v9.URL, arg1 charm.Origin, arg2 macaroon_v2.Slice) (*url.URL, charm.Origin, error)
- func (m *MockCharmRepository) ResolveWithPreferredChannel(arg0 *v9.URL, arg1 charm.Origin, arg2 macaroon_v2.Slice) (*v9.URL, charm.Origin, []string, error)
- type MockCharmRepositoryMockRecorder
- func (mr *MockCharmRepositoryMockRecorder) DownloadCharm(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockCharmRepositoryMockRecorder) GetDownloadURL(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockCharmRepositoryMockRecorder) ResolveWithPreferredChannel(arg0, arg1, arg2 interface{}) *gomock.Call
- type MockLogger
- type MockLoggerMockRecorder
- type MockRepositoryGetter
- type MockRepositoryGetterMockRecorder
- type MockStorage
- type MockStorageMockRecorder
- type RepositoryGetter
- type Storage
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(*charm.URL, corecharm.Origin, macaroon.Slice) (*url.URL, corecharm.Origin, error) ResolveWithPreferredChannel(charmURL *charm.URL, requestedOrigin corecharm.Origin, macaroons macaroon.Slice) (*charm.URL, corecharm.Origin, []string, error) DownloadCharm(charmURL *charm.URL, requestedOrigin corecharm.Origin, macaroons macaroon.Slice, 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 // The (long-lived) macaroons that where used to fetch the charm. Macaroons macaroon.Slice }
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, macaroons macaroon.Slice, 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 MockCharmArchive ¶
type MockCharmArchive struct {
// contains filtered or unexported fields
}
MockCharmArchive is a mock of CharmArchive interface
func NewMockCharmArchive ¶
func NewMockCharmArchive(ctrl *gomock.Controller) *MockCharmArchive
NewMockCharmArchive creates a new mock instance
func (*MockCharmArchive) Actions ¶
func (m *MockCharmArchive) Actions() *v9.Actions
Actions mocks base method
func (*MockCharmArchive) Config ¶
func (m *MockCharmArchive) Config() *v9.Config
Config mocks base method
func (*MockCharmArchive) EXPECT ¶
func (m *MockCharmArchive) EXPECT() *MockCharmArchiveMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockCharmArchive) LXDProfile ¶
func (m *MockCharmArchive) LXDProfile() *v9.LXDProfile
LXDProfile mocks base method
func (*MockCharmArchive) Manifest ¶
func (m *MockCharmArchive) Manifest() *v9.Manifest
Manifest mocks base method
func (*MockCharmArchive) Metrics ¶
func (m *MockCharmArchive) Metrics() *v9.Metrics
Metrics mocks base method
func (*MockCharmArchive) Revision ¶
func (m *MockCharmArchive) Revision() int
Revision mocks base method
func (*MockCharmArchive) Version ¶
func (m *MockCharmArchive) Version() string
Version mocks base method
type MockCharmArchiveMockRecorder ¶
type MockCharmArchiveMockRecorder struct {
// contains filtered or unexported fields
}
MockCharmArchiveMockRecorder is the mock recorder for MockCharmArchive
func (*MockCharmArchiveMockRecorder) Actions ¶
func (mr *MockCharmArchiveMockRecorder) Actions() *gomock.Call
Actions indicates an expected call of Actions
func (*MockCharmArchiveMockRecorder) Config ¶
func (mr *MockCharmArchiveMockRecorder) Config() *gomock.Call
Config indicates an expected call of Config
func (*MockCharmArchiveMockRecorder) LXDProfile ¶
func (mr *MockCharmArchiveMockRecorder) LXDProfile() *gomock.Call
LXDProfile indicates an expected call of LXDProfile
func (*MockCharmArchiveMockRecorder) Manifest ¶
func (mr *MockCharmArchiveMockRecorder) Manifest() *gomock.Call
Manifest indicates an expected call of Manifest
func (*MockCharmArchiveMockRecorder) Meta ¶
func (mr *MockCharmArchiveMockRecorder) Meta() *gomock.Call
Meta indicates an expected call of Meta
func (*MockCharmArchiveMockRecorder) Metrics ¶
func (mr *MockCharmArchiveMockRecorder) Metrics() *gomock.Call
Metrics indicates an expected call of Metrics
func (*MockCharmArchiveMockRecorder) Revision ¶
func (mr *MockCharmArchiveMockRecorder) Revision() *gomock.Call
Revision indicates an expected call of Revision
func (*MockCharmArchiveMockRecorder) Version ¶
func (mr *MockCharmArchiveMockRecorder) Version() *gomock.Call
Version indicates an expected call of Version
type MockCharmRepository ¶
type MockCharmRepository struct {
// contains filtered or unexported fields
}
MockCharmRepository is a mock of CharmRepository interface
func NewMockCharmRepository ¶
func NewMockCharmRepository(ctrl *gomock.Controller) *MockCharmRepository
NewMockCharmRepository creates a new mock instance
func (*MockCharmRepository) DownloadCharm ¶
func (m *MockCharmRepository) DownloadCharm(arg0 *v9.URL, arg1 charm.Origin, arg2 macaroon_v2.Slice, arg3 string) (charm.CharmArchive, charm.Origin, error)
DownloadCharm mocks base method
func (*MockCharmRepository) EXPECT ¶
func (m *MockCharmRepository) EXPECT() *MockCharmRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockCharmRepository) GetDownloadURL ¶
func (m *MockCharmRepository) GetDownloadURL(arg0 *v9.URL, arg1 charm.Origin, arg2 macaroon_v2.Slice) (*url.URL, charm.Origin, error)
GetDownloadURL mocks base method
func (*MockCharmRepository) ResolveWithPreferredChannel ¶
func (m *MockCharmRepository) ResolveWithPreferredChannel(arg0 *v9.URL, arg1 charm.Origin, arg2 macaroon_v2.Slice) (*v9.URL, charm.Origin, []string, error)
ResolveWithPreferredChannel mocks base method
type MockCharmRepositoryMockRecorder ¶
type MockCharmRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockCharmRepositoryMockRecorder is the mock recorder for MockCharmRepository
func (*MockCharmRepositoryMockRecorder) DownloadCharm ¶
func (mr *MockCharmRepositoryMockRecorder) DownloadCharm(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
DownloadCharm indicates an expected call of DownloadCharm
func (*MockCharmRepositoryMockRecorder) GetDownloadURL ¶
func (mr *MockCharmRepositoryMockRecorder) GetDownloadURL(arg0, arg1, arg2 interface{}) *gomock.Call
GetDownloadURL indicates an expected call of GetDownloadURL
func (*MockCharmRepositoryMockRecorder) ResolveWithPreferredChannel ¶
func (mr *MockCharmRepositoryMockRecorder) ResolveWithPreferredChannel(arg0, arg1, arg2 interface{}) *gomock.Call
ResolveWithPreferredChannel indicates an expected call of ResolveWithPreferredChannel
type MockLogger ¶
type MockLogger struct {
// contains filtered or unexported fields
}
MockLogger is a mock of Logger interface
func NewMockLogger ¶
func NewMockLogger(ctrl *gomock.Controller) *MockLogger
NewMockLogger creates a new mock instance
func (*MockLogger) Debugf ¶
func (m *MockLogger) Debugf(arg0 string, arg1 ...interface{})
Debugf mocks base method
func (*MockLogger) EXPECT ¶
func (m *MockLogger) EXPECT() *MockLoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockLogger) Tracef ¶
func (m *MockLogger) Tracef(arg0 string, arg1 ...interface{})
Tracef mocks base method
func (*MockLogger) Warningf ¶
func (m *MockLogger) Warningf(arg0 string, arg1 ...interface{})
Warningf mocks base method
type MockLoggerMockRecorder ¶
type MockLoggerMockRecorder struct {
// contains filtered or unexported fields
}
MockLoggerMockRecorder is the mock recorder for MockLogger
func (*MockLoggerMockRecorder) Debugf ¶
func (mr *MockLoggerMockRecorder) Debugf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Debugf indicates an expected call of Debugf
func (*MockLoggerMockRecorder) Tracef ¶
func (mr *MockLoggerMockRecorder) Tracef(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Tracef indicates an expected call of Tracef
func (*MockLoggerMockRecorder) Warningf ¶
func (mr *MockLoggerMockRecorder) Warningf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Warningf indicates an expected call of Warningf
type MockRepositoryGetter ¶
type MockRepositoryGetter struct {
// contains filtered or unexported fields
}
MockRepositoryGetter is a mock of RepositoryGetter interface
func NewMockRepositoryGetter ¶
func NewMockRepositoryGetter(ctrl *gomock.Controller) *MockRepositoryGetter
NewMockRepositoryGetter creates a new mock instance
func (*MockRepositoryGetter) EXPECT ¶
func (m *MockRepositoryGetter) EXPECT() *MockRepositoryGetterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockRepositoryGetter) GetCharmRepository ¶
func (m *MockRepositoryGetter) GetCharmRepository(arg0 charm.Source) (CharmRepository, error)
GetCharmRepository mocks base method
type MockRepositoryGetterMockRecorder ¶
type MockRepositoryGetterMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryGetterMockRecorder is the mock recorder for MockRepositoryGetter
func (*MockRepositoryGetterMockRecorder) GetCharmRepository ¶
func (mr *MockRepositoryGetterMockRecorder) GetCharmRepository(arg0 interface{}) *gomock.Call
GetCharmRepository indicates an expected call of GetCharmRepository
type MockStorage ¶
type MockStorage struct {
// contains filtered or unexported fields
}
MockStorage is a mock of Storage interface
func NewMockStorage ¶
func NewMockStorage(ctrl *gomock.Controller) *MockStorage
NewMockStorage creates a new mock instance
func (*MockStorage) EXPECT ¶
func (m *MockStorage) EXPECT() *MockStorageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockStorage) PrepareToStoreCharm ¶
func (m *MockStorage) PrepareToStoreCharm(arg0 *v9.URL) error
PrepareToStoreCharm mocks base method
func (*MockStorage) Store ¶
func (m *MockStorage) Store(arg0 *v9.URL, arg1 DownloadedCharm) error
Store mocks base method
type MockStorageMockRecorder ¶
type MockStorageMockRecorder struct {
// contains filtered or unexported fields
}
MockStorageMockRecorder is the mock recorder for MockStorage
func (*MockStorageMockRecorder) PrepareToStoreCharm ¶
func (mr *MockStorageMockRecorder) PrepareToStoreCharm(arg0 interface{}) *gomock.Call
PrepareToStoreCharm indicates an expected call of PrepareToStoreCharm
func (*MockStorageMockRecorder) Store ¶
func (mr *MockStorageMockRecorder) Store(arg0, arg1 interface{}) *gomock.Call
Store indicates an expected call of Store
type RepositoryGetter ¶
type RepositoryGetter interface {
GetCharmRepository(corecharm.Source) (CharmRepository, error)
}
RepositoryGetter returns a suitable CharmRepository for the specified Source.
type Storage ¶
type Storage interface { PrepareToStoreCharm(*charm.URL) error Store(*charm.URL, DownloadedCharm) error }
Storage provides an API for storing downloaded charms.