services

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package services is a generated GoMock package.

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

	// A transport that is injected when making charmhub API calls.
	Transport charmhub.Transport

	// 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

	// A transport that is injected when making charmhub API calls.
	Transport charmhub.Transport

	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 *charm.URL) 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 *charm.URL, 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 MockModelBackend

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

MockModelBackend is a mock of ModelBackend interface.

func NewMockModelBackend

func NewMockModelBackend(ctrl *gomock.Controller) *MockModelBackend

NewMockModelBackend creates a new mock instance.

func (*MockModelBackend) Config

func (m *MockModelBackend) Config() (*config.Config, error)

Config mocks base method.

func (*MockModelBackend) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockModelBackendMockRecorder

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

MockModelBackendMockRecorder is the mock recorder for MockModelBackend.

func (*MockModelBackendMockRecorder) Config

Config indicates an expected call of Config.

type MockStateBackend

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

MockStateBackend is a mock of StateBackend interface.

func NewMockStateBackend

func NewMockStateBackend(ctrl *gomock.Controller) *MockStateBackend

NewMockStateBackend creates a new mock instance.

func (*MockStateBackend) ControllerConfig

func (m *MockStateBackend) ControllerConfig() (controller.Config, error)

ControllerConfig mocks base method.

func (*MockStateBackend) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStateBackend) ModelUUID

func (m *MockStateBackend) ModelUUID() string

ModelUUID mocks base method.

func (*MockStateBackend) PrepareCharmUpload

func (m *MockStateBackend) PrepareCharmUpload(arg0 *v9.URL) (UploadedCharm, error)

PrepareCharmUpload mocks base method.

func (*MockStateBackend) UpdateUploadedCharm

func (m *MockStateBackend) UpdateUploadedCharm(arg0 state.CharmInfo) (UploadedCharm, error)

UpdateUploadedCharm mocks base method.

type MockStateBackendMockRecorder

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

MockStateBackendMockRecorder is the mock recorder for MockStateBackend.

func (*MockStateBackendMockRecorder) ControllerConfig

func (mr *MockStateBackendMockRecorder) ControllerConfig() *gomock.Call

ControllerConfig indicates an expected call of ControllerConfig.

func (*MockStateBackendMockRecorder) ModelUUID

func (mr *MockStateBackendMockRecorder) ModelUUID() *gomock.Call

ModelUUID indicates an expected call of ModelUUID.

func (*MockStateBackendMockRecorder) PrepareCharmUpload

func (mr *MockStateBackendMockRecorder) PrepareCharmUpload(arg0 interface{}) *gomock.Call

PrepareCharmUpload indicates an expected call of PrepareCharmUpload.

func (*MockStateBackendMockRecorder) UpdateUploadedCharm

func (mr *MockStateBackendMockRecorder) UpdateUploadedCharm(arg0 interface{}) *gomock.Call

UpdateUploadedCharm indicates an expected call of UpdateUploadedCharm.

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) Put

func (m *MockStorage) Put(arg0 string, arg1 io.Reader, arg2 int64) error

Put mocks base method.

func (*MockStorage) Remove

func (m *MockStorage) Remove(arg0 string) error

Remove mocks base method.

type MockStorageMockRecorder

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

MockStorageMockRecorder is the mock recorder for MockStorage.

func (*MockStorageMockRecorder) Put

func (mr *MockStorageMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call

Put indicates an expected call of Put.

func (*MockStorageMockRecorder) Remove

func (mr *MockStorageMockRecorder) Remove(arg0 interface{}) *gomock.Call

Remove indicates an expected call of Remove.

type MockUploadedCharm

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

MockUploadedCharm is a mock of UploadedCharm interface.

func NewMockUploadedCharm

func NewMockUploadedCharm(ctrl *gomock.Controller) *MockUploadedCharm

NewMockUploadedCharm creates a new mock instance.

func (*MockUploadedCharm) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUploadedCharm) IsUploaded

func (m *MockUploadedCharm) IsUploaded() bool

IsUploaded mocks base method.

type MockUploadedCharmMockRecorder

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

MockUploadedCharmMockRecorder is the mock recorder for MockUploadedCharm.

func (*MockUploadedCharmMockRecorder) IsUploaded

func (mr *MockUploadedCharmMockRecorder) IsUploaded() *gomock.Call

IsUploaded indicates an expected call of IsUploaded.

type ModelBackend

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

ModelBackend describes an API for accessing model-specific details.

type StateBackend

type StateBackend interface {
	ControllerConfig() (controller.Config, error)
	UpdateUploadedCharm(info state.CharmInfo) (UploadedCharm, error)
	PrepareCharmUpload(curl *charm.URL) (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.

Jump to

Keyboard shortcuts

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