pool

package
v1.0.0-alpha1.0...-2e0dbe4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 18 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 *Status) bool

func (By) Sort

func (by By) Sort(l []Status)

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 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 instance data as a list of DataElements

func (*Data[T]) Set

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

Set will add or update instance data

func (*Data[T]) Unset

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

Unset removes an instance data

type DataElement

type DataElement[T Dataer] struct {
	Name  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 {
	Type         string   `json:"type"`
	Name         string   `json:"name"`
	Capabilities []string `json:"capabilities"`
	Head         string   `json:"head"`
	Errors       []string `json:"errors"`
	VolumeCount  int      `json:"volume_count"`
	Usage
}

func GetStatus

func GetStatus(t Pooler, withUsage bool) Status

func NewStatus

func NewStatus() Status

func (Status) HasAccess

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

func (Status) HasCapability

func (t Status) HasCapability(s string) bool

func (Status) LoadTreeNode

func (t Status) LoadTreeNode(head *tree.Node)

LoadTreeNode add the tree nodes representing the type instance into another.

type StatusList

type StatusList []Status

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) LoadTreeNode

func (t StatusList) LoadTreeNode(head *tree.Node)

LoadTreeNode add the tree nodes representing the type instance into another.

func (StatusList) Render

func (t StatusList) Render(verbose bool) string

func (StatusList) Swap

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

func (StatusList) Tree

func (t StatusList) Tree() *tree.Tree

Tree returns a tree loaded with the type instance.

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 {
	// 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"`
}

func (VolumeStatus) LoadTreeNode

func (t VolumeStatus) LoadTreeNode(head *tree.Node)

LoadTreeNode add the tree nodes representing the type instance into another.

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) LoadTreeNode

func (t VolumeStatusList) LoadTreeNode(head *tree.Node)

LoadTreeNode add the tree nodes representing the type instance into another.

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