Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCharmDownloader ¶
func NewCharmDownloader(cfg CharmDownloaderConfig) (*charmdownloader.Downloader, error)
NewCharmDownloader wires the provided configuration options into a new charmdownloader.Downloader instance.
Types ¶
type ApplicationService ¶
type ApplicationService interface { // GetCharmID returns a charm ID by name. It returns an error.CharmNotFound // if the charm can not be found by the name. // This can also be used as a cheap way to see if a charm exists without // needing to load the charm metadata. GetCharmID(ctx context.Context, args charm.GetCharmArgs) (corecharm.ID, error) // GetCharm returns the charm metadata for the given charm ID. // It returns an error.CharmNotFound if the charm can not be found by the // ID. GetCharm(ctx context.Context, id corecharm.ID) (internalcharm.Charm, charm.CharmLocator, bool, error) }
ApplicationService provides access to application related operations, this includes charms, units and resources.
type CharmDownloaderConfig ¶
type CharmDownloaderConfig struct { Logger corelogger.Logger // An HTTP client that is injected when making Charmhub API calls. CharmhubHTTPClient charmhub.HTTPClient // ObjectStore provides access to the object store for a // given model. ObjectStore Storage ModelConfigService ModelConfigService }
CharmDownloaderConfig encapsulates the information required for creating a new CharmDownloader instance.
type CharmRepoFactory ¶
type CharmRepoFactory struct {
// contains filtered or unexported fields
}
CharmRepoFactory instantiates charm repositories. It memoizes created repositories allowing them to be reused by subsequent GetCharmRepository calls.
func NewCharmRepoFactory ¶
func NewCharmRepoFactory(cfg CharmRepoFactoryConfig) *CharmRepoFactory
NewCharmRepoFactory returns a new factory instance with the provided configuration.
func (*CharmRepoFactory) GetCharmRepository ¶
func (f *CharmRepoFactory) GetCharmRepository(ctx context.Context, src corecharm.Source) (corecharm.Repository, error)
GetCharmRepository returns a suitable corecharm.Repository instance for the requested source. Lookups are memoized for future requests.
type CharmRepoFactoryConfig ¶
type CharmRepoFactoryConfig struct { // An HTTP client that is injected when making Charmhub API calls. CharmhubHTTPClient charmhub.HTTPClient // ModelConfigService provides access to the model configuration. ModelConfigService ModelConfigService Logger corelogger.Logger }
CharmRepoFactoryConfig encapsulates the information required for creating a new CharmRepoFactory instance.
type CharmStorage ¶
type CharmStorage struct {
// contains filtered or unexported fields
}
CharmStorage provides an abstraction for storing charm blobs.
func NewCharmStorage ¶
func NewCharmStorage(cfg CharmStorageConfig) *CharmStorage
NewCharmStorage creates a new CharmStorage instance with the specified config.
func (*CharmStorage) PrepareToStoreCharm ¶
func (s *CharmStorage) PrepareToStoreCharm(charmURL string) error
PrepareToStoreCharm ensures that the store is ready to process the specified charm URL. If the blob for the charm is already stored, the method returns an error to indicate this.
func (*CharmStorage) Store ¶
func (s *CharmStorage) Store(ctx context.Context, charmURL string, downloadedCharm charmdownloader.DownloadedCharm) (string, error)
CharmStorage attempts to store the contents of a downloaded charm.
type CharmStorageConfig ¶
type CharmStorageConfig struct { // The logger to use. Logger logger.Logger // A factory for accessing model-scoped storage for charm blobs. ObjectStore Storage ApplicationService ApplicationService }
CharmStorageConfig encapsulates the information required for creating a new CharmStorage instance.
type ModelConfigService ¶
type ModelConfigService interface { // ModelConfig returns the current config for the model. ModelConfig(context.Context) (*config.Config, error) }
ModelConfigService provides access to the model configuration.
type Storage ¶
type Storage interface { // Put stores data from reader at path, namespaced to the model. Put(context.Context, string, io.Reader, int64) (objectstore.UUID, error) // Remove removes data at path, namespaced to the model. Remove(context.Context, string) error }
Storage describes an API for storing and deleting blobs.