state

package
v0.0.0-...-56cb166 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateStoragePools

func CreateStoragePools(ctx context.Context, db domain.TxnRunner, pools []domainstorage.StoragePoolDetails) error

CreateStoragePools creates the specified storage pools. It is exported for us in the storage/bootstrap package.

func GetStoragePoolByName

func GetStoragePoolByName(ctx context.Context, db domain.TxnRunner, name string) (domainstorage.StoragePoolDetails, error)

GetStoragePoolByName returns the storage pool with the specified name, returning an error satisfying storageerrors.PoolNotFoundError if it doesn't exist. Exported for use by other domains that need to load storage pools.

Types

type State

type State struct {
	*domain.StateBase
}

State represents database interactions dealing with storage.

func NewState

func NewState(factory coredatabase.TxnRunnerFactory) *State

NewState returns a new storage state based on the input database factory method.

func (State) CreateStoragePool

func (st State) CreateStoragePool(ctx context.Context, pool domainstorage.StoragePoolDetails) error

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

func (State) DeleteStoragePool

func (st State) DeleteStoragePool(ctx context.Context, name string) error

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

func (State) GetModelDetails

func (s State) GetModelDetails() (domainstorage.ModelDetails, error)

func (State) GetStoragePoolByName

func (st State) GetStoragePoolByName(ctx context.Context, name string) (domainstorage.StoragePoolDetails, error)

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

func (State) ImportFilesystem

func (s State) ImportFilesystem(ctx context.Context, name storage.Name, filesystem domainstorage.FilesystemInfo) (storage.ID, error)

func (State) ListStoragePools

func (st State) ListStoragePools(ctx context.Context, names domainstorage.Names, providers domainstorage.Providers) ([]domainstorage.StoragePoolDetails, error)

ListStoragePools returns the storage pools matching the specified filter.

func (State) ReplaceStoragePool

func (st State) ReplaceStoragePool(ctx context.Context, pool domainstorage.StoragePoolDetails) error

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

type StoragePool

type StoragePool struct {
	ID string `db:"uuid"`

	Name         string `db:"name"`
	ProviderType string `db:"type"`
}

type StoragePoolNames

type StoragePoolNames []string

type StoragePools

type StoragePools []StoragePool

type StorageProviderTypes

type StorageProviderTypes []string

Jump to

Keyboard shortcuts

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