pool

package
v3.0.0-beta10 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureVolume

func ConfigureVolume(p Pooler, vol Volumer, size int64, format bool, acs volaccess.T, shared bool, nodes []string, env []string) error

func DiskName

func DiskName(p Pooler, vol Volumer) string

func Driver

func Driver(t string) func() Pooler

func GetMappings

func GetMappings(p ArrayPooler, nodes []string, pathType string) (array.Mappings, error)

func GetPaths

func GetPaths(p ArrayPooler, nodes []string, pathType string) (san.Paths, error)

func HasAccess

func HasAccess(p Pooler, acs volaccess.T) bool

func HasCapability

func HasCapability(p Pooler, s string) bool

func InitData

func InitData()

InitData reset package instances data, it can be used for tests.

func MappingsFromPaths

func MappingsFromPaths(paths san.Paths) (array.Mappings, error)

func MountPointFromName

func MountPointFromName(name string) string

Types

type ArrayPooler

type ArrayPooler interface {
	Pooler
	GetTargets() (san.Targets, error)
	CreateDisk(name string, size int64, nodenames []string) ([]Disk, error)
	DeleteDisk(name, wwid string) ([]Disk, error)
}

type BlkTranslater

type BlkTranslater interface {
	BlkTranslate(name string, size int64, shared bool) ([]string, error)
}

type By

type By func(p1, p2 *StatusItem) bool

func (By) Sort

func (by By) Sort(l StatusList)

type Capabilities

type Capabilities []string

type Config

type Config interface {
	Eval(key.T) (any, error)
	GetInt(key.T) int
	GetString(key.T) string
	GetStringAs(key.T, string) string
	GetStringStrict(key.T) (string, error)
	GetStrings(key.T) []string
	GetBool(k key.T) bool
	GetSize(k key.T) *int64
	HasSectionString(s string) bool
}

type Data

type Data[T Dataer] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Data defines a shared holder for all pool Dataer

var (

	// StatusData is the package data holder for all instances statuses
	StatusData *Data[Status]
)

func NewData

func NewData[T Dataer]() *Data[T]

func (*Data[T]) Get

func (c *Data[T]) Get(name, node string) *T

Get returns a pool data or nil if data is not found

func (*Data[T]) GetAll

func (c *Data[T]) GetAll() []DataElement[T]

GetAll returns all pool data as a list of DataElements

func (*Data[T]) GetByName

func (c *Data[T]) GetByName(name string) []DataElement[T]

GetByName returns pool instances on a specific node as a list of DataElements

func (*Data[T]) GetByNode

func (c *Data[T]) GetByNode(nodename string) []DataElement[T]

GetByNode returns pool instances on a specific node as a list of DataElements

func (*Data[T]) Set

func (c *Data[T]) Set(name, node string, v *T)

Set will add or update instance data

func (*Data[T]) Unset

func (c *Data[T]) Unset(name, node string)

Unset removes an instance data

type DataElement

type DataElement[T Dataer] struct {
	Name  string
	Node  string
	Value *T
}

type Dataer

type Dataer interface {
	Status
}

type Disk

type Disk struct {
	// ID is the created disk wwid
	ID string

	// Paths is the subset of requested san path actually setup for this disk
	Paths san.Paths

	// Driver is a driver-specific dataset
	Driver any
}

type Lookup

type Lookup struct {
	Name   string
	Type   string
	Access volaccess.T
	Size   int64
	Format bool
	Shared bool
	Usage  bool
	Nodes  []string
	// contains filtered or unexported fields
}

func NewLookup

func NewLookup(m manager) *Lookup

func (Lookup) ConfigureVolume

func (t Lookup) ConfigureVolume(volume Volumer, obj interface{}) error

func (Lookup) Do

func (t Lookup) Do() (Pooler, error)

func (Lookup) Env

func (t Lookup) Env(p Pooler, c consumer, optional bool) ([]string, error)

type Pooler

type Pooler interface {
	SetName(string)
	SetDriver(string)
	Name() string
	Type() string
	Head() string
	Mappings() map[string]string
	Capabilities() []string
	Usage() (Usage, error)
	SetConfig(Config)
	Config() Config
	Separator() string
}

func New

func New(name string, config Config) Pooler

type Status

type Status struct {
	Usage
	Capabilities []string  `json:"capabilities"`
	Errors       []string  `json:"errors"`
	Head         string    `json:"head"`
	Type         string    `json:"type"`
	UpdatedAt    time.Time `json:"updated_at"`
	VolumeCount  int       `json:"volume_count"`
}

func GetStatus

func GetStatus(t Pooler, withUsage bool) Status

func NewStatus

func NewStatus() Status

func (*Status) DeepCopy

func (t *Status) DeepCopy() *Status

func (*Status) HasAccess

func (t *Status) HasAccess(acs volaccess.T) bool

func (*Status) HasCapability

func (t *Status) HasCapability(s string) bool

type StatusItem

type StatusItem struct {
	Status
	Name string `json:"name"`
}

type StatusList

type StatusList []StatusItem

func NewStatusList

func NewStatusList() StatusList

func (StatusList) Add

func (t StatusList) Add(p Pooler, withUsage bool) StatusList

func (StatusList) Len

func (t StatusList) Len() int

func (StatusList) Less

func (t StatusList) Less(i, j int) bool

func (StatusList) Swap

func (t StatusList) Swap(i, j int)

type T

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

func (*T) AddFS

func (t *T) AddFS(name string, shared bool, fsIndex int, diskIndex int, onDisk string) []string

func (*T) Config

func (t *T) Config() Config

func (*T) FSType

func (t *T) FSType() string

func (*T) GetBool

func (t *T) GetBool(s string) bool

func (*T) GetInt

func (t *T) GetInt(s string) int

func (*T) GetSize

func (t *T) GetSize(s string) *int64

func (*T) GetString

func (t *T) GetString(s string) string

func (*T) GetStringAs

func (t *T) GetStringAs(s, nodename string) string

func (*T) GetStrings

func (t *T) GetStrings(s string) []string

func (*T) Mappings

func (t *T) Mappings() map[string]string

func (*T) MkblkOptions

func (t *T) MkblkOptions() string

func (*T) MkfsOptions

func (t *T) MkfsOptions() string

func (*T) MntOptions

func (t *T) MntOptions() string

func (T) Name

func (t T) Name() string

func (T) Separator

func (t T) Separator() string

Separator is the string to use as the separator between name and hostname in the array-side disk name. Some array have a restricted characterset for such names, so better let the pool driver decide.

func (*T) SetConfig

func (t *T) SetConfig(c Config)

func (*T) SetDriver

func (t *T) SetDriver(driver string)

func (*T) SetName

func (t *T) SetName(name string)

func (T) Type

func (t T) Type() string

type Translater

type Translater interface {
	Translate(name string, size int64, shared bool) ([]string, error)
}

type Usage

type Usage struct {
	Shared bool `json:"shared"`
	// Free unit is Bytes
	Free int64 `json:"free"`
	// Used unit is Bytes
	Used int64 `json:"used"`
	// Size unit is Bytes
	Size int64 `json:"size"`
}

type VolumeStatus

type VolumeStatus struct {
	Pool     string       `json:"pool"`
	Path     naming.Path  `json:"path"`
	Children naming.Paths `json:"children"`
	IsOrphan bool         `json:"is_orphan"`
	Size     int64        `json:"size"`
}

type VolumeStatusList

type VolumeStatusList []VolumeStatus

func (VolumeStatusList) Len

func (t VolumeStatusList) Len() int

func (VolumeStatusList) Less

func (t VolumeStatusList) Less(i, j int) bool

func (VolumeStatusList) Swap

func (t VolumeStatusList) Swap(i, j int)

type Volumer

type Volumer interface {
	FQDN() string
	Config() *xconfig.T
}

type WeightedPools

type WeightedPools []Pooler

Jump to

Keyboard shortcuts

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