service

package
v0.0.0-...-a81527e Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImportStorageParams

type ImportStorageParams struct {
	// Kind is the kind of the storage to import.
	Kind internalstorage.StorageKind

	// Pool is the name of the storage pool into which the storage is to
	// be imported.
	Pool string

	// ProviderId is the storage provider's unique ID for the storage,
	// e.g. the EBS volume ID.
	ProviderId string

	// StorageName is the name to assign to the imported storage.
	StorageName storage.Name
}

ImportStorageParams contains the parameters for importing storage into a model.

type PoolAttrs

type PoolAttrs map[string]any

PoolAttrs define the attributes of a storage pool.

type Service

type Service struct {
	*StoragePoolService
	*StorageService
}

Service defines a service for interacting with the underlying state.

func NewService

func NewService(st State, logger logger.Logger, registryGetter corestorage.ModelStorageRegistryGetter) *Service

NewService returns a new Service for interacting with the underlying state.

func (*Service) GetStorageRegistry deprecated

func (s *Service) GetStorageRegistry(ctx context.Context) (internalstorage.ProviderRegistry, error)

GetStorageRegistry returns the storage registry for the model.

Deprecated: This method will be removed once the storage registry is fully implemented in each service.

type State

type State interface {
	StoragePoolState
	StorageState
}

State defines an interface for interacting with the underlying state.

type StoragePoolService

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

StoragePoolService defines a service for interacting with the underlying state.

func (*StoragePoolService) AllStoragePools

func (s *StoragePoolService) AllStoragePools(ctx context.Context) ([]*storage.Config, error)

AllStoragePools returns the all storage pools.

func (*StoragePoolService) CreateStoragePool

func (s *StoragePoolService) CreateStoragePool(ctx context.Context, name string, providerType storage.ProviderType, attrs PoolAttrs) error

CreateStoragePool creates a storage pool, returning an error satisfying errors.AlreadyExists if a pool with the same name already exists.

func (*StoragePoolService) DeleteStoragePool

func (s *StoragePoolService) DeleteStoragePool(ctx context.Context, name string) error

DeleteStoragePool deletes a storage pool, returning an error satisfying errors.NotFound if it doesn't exist.

func (*StoragePoolService) GetStoragePoolByName

func (s *StoragePoolService) GetStoragePoolByName(ctx context.Context, name string) (*storage.Config, error)

GetStoragePoolByName returns the storage pool with the specified name, returning an error satisfying storageerrors.PoolNotFoundError if it doesn't exist.

func (*StoragePoolService) ListStoragePools

func (s *StoragePoolService) ListStoragePools(ctx context.Context, names domainstorage.Names, providers domainstorage.Providers) ([]*storage.Config, error)

ListStoragePools returns the storage pools matching the specified filter.

func (*StoragePoolService) ReplaceStoragePool

func (s *StoragePoolService) ReplaceStoragePool(ctx context.Context, name string, providerType storage.ProviderType, attrs PoolAttrs) error

ReplaceStoragePool replaces an existing storage pool, returning an error satisfying storageerrors.PoolNotFoundError if a pool with the name does not exist.

type StoragePoolState

type StoragePoolState interface {
	CreateStoragePool(ctx context.Context, pool domainstorage.StoragePoolDetails) error
	DeleteStoragePool(ctx context.Context, name string) error
	ReplaceStoragePool(ctx context.Context, pool domainstorage.StoragePoolDetails) error
	ListStoragePools(ctx context.Context, filter domainstorage.Names, providers domainstorage.Providers) ([]domainstorage.StoragePoolDetails, error)
	GetStoragePoolByName(ctx context.Context, name string) (domainstorage.StoragePoolDetails, error)
}

StoragePoolState defines an interface for interacting with the underlying state.

type StorageService

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

StorageService defines a service for storage related behaviour.

func (*StorageService) ImportFilesystem

func (s *StorageService) ImportFilesystem(ctx context.Context, arg ImportStorageParams) (corestorage.ID, error)

ImportFilesystem associates a filesystem (either native or volume backed) hosted by a cloud provider with a new storage instance (and storage pool) in a model. The following error types can be expected: - coreerrors.NotSupported: when the importing the kind of storage is not supported by the provider. - storageerrors.InvalidPoolNameError: when the supplied pool name is invalid.

type StorageState

type StorageState interface {
	// GetModelDetails returns the model and controller UUID for the current model.
	GetModelDetails() (storage.ModelDetails, error)
	// ImportFilesystem associates a filesystem (either native or volume backed) hosted by a cloud provider
	// with a new storage instance (and storage pool) in a model.
	ImportFilesystem(ctx context.Context, name corestorage.Name,
		filesystem storage.FilesystemInfo) (corestorage.ID, error)
}

StorageState defines an interface for interacting with the underlying state.

Jump to

Keyboard shortcuts

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