storage

package
v0.0.0-...-ed0863b Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: AGPL-3.0 Imports: 16 Imported by: 7

Documentation

Index

Constants

View Source
const (
	StoragePoolName     = "name"
	StorageProviderType = "type"
)

Pool configuration attribute names.

Variables

View Source
var (
	NilNames     = Names(nil)
	NilProviders = Providers(nil)
)

These consts are used to specify nil filter terms.

Functions

func DefaultStoragePools

func DefaultStoragePools(registry storage.ProviderRegistry) ([]*storage.Config, error)

DefaultStoragePools returns the default storage pools to add to a new model for a given provider registry.

func FilesystemMountPoint

func FilesystemMountPoint(
	parentDir string,
	location string,
	maxCount int,
	storageID corestorage.ID,
) (string, error)

FilesystemMountPoint returns a mount point to use for the given charm storage. For stores with potentially multiple instances, the instance ID is appended to the location.

func NewStorageDirectivesValidator

func NewStorageDirectivesValidator(modelType coremodel.ModelType, registry storage.ProviderRegistry, storagePoolGetter StoragePoolGetter) (*storageDirectivesValidator, error)

NewStorageDirectivesValidator creates a validator that can be used to check storage directives are compatible with a given charm.

func StorageDirectivesWithDefaults

func StorageDirectivesWithDefaults(
	charmStorage map[string]charm.Storage,
	modelType coremodel.ModelType,
	defaults StorageDefaults,
	allDirectives map[string]storage.Directive,
) (map[string]storage.Directive, error)

StorageDirectivesWithDefaults takes a storage directives map and fills in any defaults as required.

Types

type Attrs

type Attrs map[string]string

Attrs defines storage attributes.

type Charm

type Charm interface {
	Meta() *charm.Meta
}

Charm provides access to charm metadata.

type FilesystemInfo

type FilesystemInfo struct {
	storage.FilesystemInfo
	Pool          string
	BackingVolume *storage.VolumeInfo
}

FilesystemInfo describes information about a filesystem.

type ModelDetails

type ModelDetails struct {
	ModelUUID      string
	ControllerUUID string
}

ModelDetails describes details about a model.

type Names

type Names []string

These type aliases are used to specify filter terms.

type Providers

type Providers []string

These type aliases are used to specify filter terms.

type ProvisioningStatus

type ProvisioningStatus int

ProvisioningStatus represents the status of a storage entity as recorded in the storage provisioning status lookup table.

const (
	ProvisioningStatusPending ProvisioningStatus = iota
	ProvisioningStatusProvisioned
	ProvisioningStatusError
)

type StorageDefaults

type StorageDefaults struct {
	DefaultBlockSource      *string
	DefaultFilesystemSource *string
}

StorageDefaults holds the default sources of storage for an application.

type StorageDirectivesValidator

type StorageDirectivesValidator interface {
	ValidateStorageDirectivesAgainstCharm(ctx context.Context, allDirectives map[string]storage.Directive, charm Charm) error
}

StorageDirectivesValidator instances can be used to check storage directives are compatible with a given charm.

type StorageKind

type StorageKind int

StorageKind represents the kind of storage as recorded in the storage kind lookup table.

const (
	StorageKindBlock StorageKind = iota
	StorageKindFilesystem
)

type StoragePoolDetails

type StoragePoolDetails struct {
	Name     string
	Provider string
	Attrs    Attrs
}

StoragePoolDetails defines the details of a storage pool to save. This type is also used when returning query results from state.

func BuiltInStoragePools

func BuiltInStoragePools() ([]StoragePoolDetails, error)

BuiltInStoragePools returns the built in providers common to all.

type StoragePoolGetter

type StoragePoolGetter interface {
	GetStoragePoolByName(ctx context.Context, name string) (StoragePoolDetails, error)
}

StoragePoolGetter provides access to a storage pool getter for validation purposes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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