services

package
v0.0.0-...-439fd0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

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 CharmDownloaderConfig

type CharmDownloaderConfig struct {
	// The logger to use.
	Logger loggo.Logger

	// An HTTP client that is injected when making Charmhub API calls.
	CharmhubHTTPClient charmhub.HTTPClient

	// A factory for accessing model-scoped storage for charm blobs.
	StorageFactory func(modelUUID string) Storage

	StateBackend StateBackend
	ModelBackend ModelBackend
}

CharmDownloaderConfig encapsulates the information required for creating a new CharmDownloader instance.

type CharmRepoFactory

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

CharmRepoFactory instantitates 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(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 {
	// The logger to use.
	Logger loggo.Logger

	// An HTTP client that is injected when making Charmhub API calls.
	CharmhubHTTPClient charmhub.HTTPClient

	StateBackend StateBackend
	ModelBackend ModelBackend
}

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(charmURL string, downloadedCharm charmdownloader.DownloadedCharm) error

CharmStorage attempts to store the contents of a downloaded charm.

type CharmStorageConfig

type CharmStorageConfig struct {
	// The logger to use.
	Logger loggo.Logger

	// A factory for accessing model-scoped storage for charm blobs.
	StorageFactory func(modelUUID string) Storage

	StateBackend StateBackend
}

CharmStorageConfig encapsulates the information required for creating a new CharmStorage instance.

type ModelBackend

type ModelBackend interface {
	Config() (*config.Config, error)
}

ModelBackend describes an API for accessing model-specific details.

type StateBackend

type StateBackend interface {
	UpdateUploadedCharm(info state.CharmInfo) (UploadedCharm, error)
	PrepareCharmUpload(curl string) (UploadedCharm, error)
	ModelUUID() string
}

StateBackend describes an API for accessing/mutating information in state.

type Storage

type Storage interface {
	Put(path string, r io.Reader, length int64) error
	Remove(path string) error
}

Storage describes an API for storing and deleting blobs.

type UploadedCharm

type UploadedCharm interface {
	IsUploaded() bool
}

UploadedCharm represents a charm whose upload status can be queried.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL