storageclass

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	//NOTE:  Ensure that any changes made to this data structure are reflected
	// in the Unmarshal method of config.go
	Version         string                              `json:"version" hash:"ignore"`
	Name            string                              `json:"name" hash:"ignore"`
	Attributes      map[string]storageattribute.Request `json:"attributes,omitempty"`
	Pools           map[string][]string                 `json:"storagePools,omitempty"`
	AdditionalPools map[string][]string                 `json:"additionalStoragePools,omitempty"`
	ExcludePools    map[string][]string                 `json:"excludeStoragePools,omitempty"`
}

func (*Config) MarshalJSON

func (c *Config) MarshalJSON() ([]byte, error)

MarshalJSON emits a storage class config struct as a JSON-formatted byte array.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON parses a JSON-formatted byte array into a storage class config struct.

type External

type External struct {
	Config       *Config
	StoragePools map[string][]string `json:"storage"` // Backend -> list of StoragePools
}

func (*External) GetName

func (s *External) GetName() string

type Persistent

type Persistent struct {
	Config *Config `json:"config"`
}

Persistent contains the minimal information needed to persist a StorageClass. This exists to give us some flexibility to evolve the struct; it also avoids overloading the semantics of Config and is consistent with BackendExternal.

func (*Persistent) GetName

func (s *Persistent) GetName() string

type StorageClass

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

func New

func New(c *Config) *StorageClass

func NewForConfig

func NewForConfig(configJSON string) (*StorageClass, error)

func NewFromAttributes

func NewFromAttributes(attributes map[string]storageattribute.Request) *StorageClass

func NewFromPersistent

func NewFromPersistent(persistent *Persistent) *StorageClass

func (*StorageClass) CheckAndAddBackend

func (s *StorageClass) CheckAndAddBackend(b *storage.Backend) int

CheckAndAddBackend iterates through each of the storage pools for a given backend. If the pool satisfies the storage class, it adds that pool. Returns the number of storage pools added.

func (*StorageClass) ConstructExternal

func (s *StorageClass) ConstructExternal() *External

func (*StorageClass) ConstructPersistent

func (s *StorageClass) ConstructPersistent() *Persistent

func (*StorageClass) GetAdditionalStoragePools

func (s *StorageClass) GetAdditionalStoragePools() map[string][]string

func (*StorageClass) GetAttributes

func (s *StorageClass) GetAttributes() map[string]storageattribute.Request

func (*StorageClass) GetName

func (s *StorageClass) GetName() string

func (*StorageClass) GetStoragePools

func (s *StorageClass) GetStoragePools() map[string][]string

func (*StorageClass) GetStoragePoolsForProtocol

func (s *StorageClass) GetStoragePoolsForProtocol(p config.Protocol) []*storage.Pool

func (*StorageClass) IsAddedToBackend

func (s *StorageClass) IsAddedToBackend(backend *storage.Backend, storageClassName string) bool

func (*StorageClass) Matches

func (s *StorageClass) Matches(storagePool *storage.Pool) bool

func (*StorageClass) Pools

func (s *StorageClass) Pools() []*storage.Pool

func (*StorageClass) RemovePoolsForBackend

func (s *StorageClass) RemovePoolsForBackend(backend *storage.Backend)

Jump to

Keyboard shortcuts

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