poolmanager

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: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "name"
	Type = "type"
)

Pool configuration attribute names.

Variables

View Source
var (
	MissingTypeError = errors.New("provider type is missing")
	MissingNameError = errors.New("pool name is missing")
)

Functions

func AddDefaultStoragePools

func AddDefaultStoragePools(p storage.Provider, pm PoolManager) error

AddDefaultStoragePools adds the default storage pools for the given provider to the given pool manager. This is called whenever a new model is created.

Types

type MemSettings

type MemSettings struct {
	Settings map[string]map[string]interface{}
}

MemSettings is an in-memory implementation of SettingsManager. This type does not provide any goroutine-safety.

func (MemSettings) CreateSettings

func (m MemSettings) CreateSettings(key string, settings map[string]interface{}) error

CreateSettings is part of the SettingsManager interface.

func (MemSettings) ListSettings

func (m MemSettings) ListSettings(keyPrefix string) (map[string]map[string]interface{}, error)

ListSettings is part of the SettingsManager interface.

func (MemSettings) ReadSettings

func (m MemSettings) ReadSettings(key string) (map[string]interface{}, error)

ReadSettings is part of the SettingsManager interface.

func (MemSettings) RemoveSettings

func (m MemSettings) RemoveSettings(key string) error

RemoveSettings is part of the SettingsManager interface.

func (MemSettings) ReplaceSettings

func (m MemSettings) ReplaceSettings(key string, settings map[string]interface{}) error

ReplaceSettings is part of the SettingsManager interface.

type PoolManager

type PoolManager interface {
	// Create makes a new pool with the specified configuration and persists it to state.
	Create(name string, providerType storage.ProviderType, attrs map[string]interface{}) (*storage.Config, error)

	// Delete removes the pool with name from state.
	Delete(name string) error

	// Replace replaces pool configuration with the newly provided values.
	Replace(name, provider string, attrs map[string]interface{}) error

	// Get returns the pool with name from state.
	Get(name string) (*storage.Config, error)

	// List returns all the pools from state.
	List() ([]*storage.Config, error)
}

A PoolManager provides access to storage pools.

func New

func New(settings SettingsManager, registry storage.ProviderRegistry) PoolManager

New returns a PoolManager implementation using the specified state.

type SettingsManager

type SettingsManager interface {
	CreateSettings(key string, settings map[string]interface{}) error
	ReplaceSettings(key string, settings map[string]interface{}) error
	ReadSettings(key string) (map[string]interface{}, error)
	RemoveSettings(key string) error
	ListSettings(keyPrefix string) (map[string]map[string]interface{}, error)
}

Jump to

Keyboard shortcuts

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