Documentation ¶
Index ¶
- Constants
- Variables
- func AddDefaultStoragePools(p storage.Provider, pm PoolManager) error
- type MemSettings
- func (m MemSettings) CreateSettings(key string, settings map[string]interface{}) error
- func (m MemSettings) ListSettings(keyPrefix string) (map[string]map[string]interface{}, error)
- func (m MemSettings) ReadSettings(key string) (map[string]interface{}, error)
- func (m MemSettings) RemoveSettings(key string) error
- func (m MemSettings) ReplaceSettings(key string, settings map[string]interface{}) error
- type PoolManager
- type SettingsManager
Constants ¶
const ( Name = "name" Type = "type" )
Pool configuration attribute names.
Variables ¶
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 ¶
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) }