Documentation ¶
Index ¶
- func FilterPoolsOnNasType(ctx context.Context, pools []storage.Pool, ...) []storage.Pool
- func FilterPoolsOnTopology(ctx context.Context, pools []storage.Pool, ...) []storage.Pool
- func SortPoolsByPreferredTopologies(ctx context.Context, pools []storage.Pool, ...) []storage.Pool
- type BackendPoolInfo
- type Config
- type External
- type Persistent
- type StorageClass
- func (s *StorageClass) CheckAndAddBackend(ctx context.Context, b storage.Backend) int
- func (s *StorageClass) ConstructExternal(ctx context.Context) *External
- func (s *StorageClass) ConstructPersistent() *Persistent
- func (s *StorageClass) GetAdditionalStoragePools() map[string][]string
- func (s *StorageClass) GetAttributes() map[string]storageattribute.Request
- func (s *StorageClass) GetName() string
- func (s *StorageClass) GetStoragePools() map[string][]string
- func (s *StorageClass) GetStoragePoolsForProtocol(ctx context.Context, p config.Protocol, accessMode config.AccessMode) []storage.Pool
- func (s *StorageClass) GetStoragePoolsForProtocolByBackend(ctx context.Context, p config.Protocol, ...) []storage.Pool
- func (s *StorageClass) IsAddedToBackend(backend storage.Backend, storageClassName string) bool
- func (s *StorageClass) Matches(ctx context.Context, storagePool storage.Pool) bool
- func (s *StorageClass) Pools() []storage.Pool
- func (s *StorageClass) RemovePoolsForBackend(backend storage.Backend)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterPoolsOnNasType ¶
func FilterPoolsOnNasType( ctx context.Context, pools []storage.Pool, scAttributes map[string]storageattribute.Request, ) []storage.Pool
FilterPoolsOnNasType returns pools filtered over nasType SMB. If not found returns the provided pool list as it is.
func FilterPoolsOnTopology ¶
func FilterPoolsOnTopology( ctx context.Context, pools []storage.Pool, requisiteTopologies []map[string]string, ) []storage.Pool
FilterPoolsOnTopology returns a subset of the provided pools that can support any of the requisiteTopologies.
func SortPoolsByPreferredTopologies ¶
func SortPoolsByPreferredTopologies( ctx context.Context, pools []storage.Pool, preferredTopologies []map[string]string, ) []storage.Pool
SortPoolsByPreferredTopologies returns a list of pools ordered by the pools supportedTopologies field against the provided list of preferredTopologies. If 2 or more pools can support a given preferredTopology, they are shuffled randomly within that segment of the list, in order to prevent hotspots.
Types ¶
type BackendPoolInfo ¶
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 ¶
MarshalJSON emits a storage class config struct as a JSON-formatted byte array.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON parses a JSON-formatted byte array into a storage class config struct.
type External ¶
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 ¶
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(ctx context.Context) *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( ctx context.Context, p config.Protocol, accessMode config.AccessMode, ) []storage.Pool
func (*StorageClass) GetStoragePoolsForProtocolByBackend ¶
func (s *StorageClass) GetStoragePoolsForProtocolByBackend( ctx context.Context, p config.Protocol, requisiteTopologies, preferredTopologies []map[string]string, accessMode config.AccessMode, ) []storage.Pool
GetStoragePoolsForProtocolByBackend returns an ordered list of pools, where each pool matches the supplied protocol.
func (*StorageClass) IsAddedToBackend ¶
func (s *StorageClass) IsAddedToBackend(backend storage.Backend, storageClassName string) bool
func (*StorageClass) Pools ¶
func (s *StorageClass) Pools() []storage.Pool
func (*StorageClass) RemovePoolsForBackend ¶
func (s *StorageClass) RemovePoolsForBackend(backend storage.Backend)