types

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCapacity = errors.New("invalid capacity")
	ErrInvalidVolume   = errors.New("invalid volume")
	ErrInvalidStorage  = errors.New("invalid storage")
	ErrInvalidVolumes  = errors.New("invalid volumes")
	ErrInvalidParams   = errors.New("invalid io parameters")
)

Functions

This section is empty.

Types

type EngineParams

type EngineParams struct {
	Volumes       []string `json:"volumes" mapstructure:"volumes"`
	VolumeChanged bool     `json:"volume_changed" mapstructure:"volume_changed"` // indicates whether the realloc request includes new volumes
	Storage       int64    `json:"storage" mapstructure:"storage"`
}

EngineParams .

type NodeResource

type NodeResource struct {
	SizeInBytes int64 `json:"size_in_bytes" mapstructure:"size_in_bytes"`
}

NodeResource indicate node cpumem resource

func NewNodeResource

func NewNodeResource(sz int64) *NodeResource

func (*NodeResource) Add

func (r *NodeResource) Add(r1 *NodeResource)

Add .

func (*NodeResource) DeepCopy

func (r *NodeResource) DeepCopy() *NodeResource

DeepCopy .

func (*NodeResource) Parse

func (r *NodeResource) Parse(rawParams resourcetypes.RawParams) error

Parse .

func (*NodeResource) Sub

func (r *NodeResource) Sub(r1 *NodeResource)

Sub .

func (*NodeResource) Validate

func (r *NodeResource) Validate() error

type NodeResourceInfo

type NodeResourceInfo struct {
	Capacity *NodeResource `json:"capacity"`
	Usage    *NodeResource `json:"usage"`
}

NodeResourceInfo indicate cpumem capacity and usage

func (*NodeResourceInfo) AvailableSize

func (n *NodeResourceInfo) AvailableSize() int64

func (*NodeResourceInfo) CapSize

func (n *NodeResourceInfo) CapSize() int64

func (*NodeResourceInfo) DeepCopy

func (n *NodeResourceInfo) DeepCopy() *NodeResourceInfo

DeepCopy .

func (*NodeResourceInfo) GetAvailableResource

func (n *NodeResourceInfo) GetAvailableResource() *NodeResource

func (*NodeResourceInfo) UsageSize

func (n *NodeResourceInfo) UsageSize() int64

func (*NodeResourceInfo) Validate

func (n *NodeResourceInfo) Validate() error

type NodeResourceRequest

type NodeResourceRequest struct {
	SizeInBytes int64 `json:"size_in_bytes" mapstructure:"size_in_bytes"`
}

NodeResourceRequest includes all possible fields passed by eru-core for editing node, it not parsed!

func (*NodeResourceRequest) Parse

func (n *NodeResourceRequest) Parse(rawParams resourcetypes.RawParams) error

type VolumeBinding

type VolumeBinding struct {
	Pool        string `json:"pool" mapstructure:"pool"`
	Image       string `json:"image" mapstructure:"image"`
	Destination string `json:"dest" mapstructure:"destination"`
	Flags       string `json:"flags" mapstructure:"flags"`
	SizeInBytes int64  `json:"size_in_bytes" mapstructure:"size_in_bytes"`
	ReadIOPS    int64  `json:"read_iops" mapstructure:"read_iops"`
	WriteIOPS   int64  `json:"write_iops" mapstructure:"write_iops"`
	ReadBPS     int64  `json:"read_bps" mapstructure:"read_bps"`
	WriteBPS    int64  `json:"write_bps" mapstructure:"write_bps"`
}

VolumeBinding format => pool/image:dst[:flags][:size][:read_IOPS:write_IOPS:read_bytes:write_bytes]

func NewVolumeBinding

func NewVolumeBinding(volume string) (_ *VolumeBinding, err error)

NewVolumeBinding returns pointer of VolumeBinding

func (*VolumeBinding) DeepCopy

func (vb *VolumeBinding) DeepCopy() *VolumeBinding

func (*VolumeBinding) GetMapKey

func (vb *VolumeBinding) GetMapKey() [3]string

func (*VolumeBinding) GetSource

func (vb *VolumeBinding) GetSource() string

func (VolumeBinding) ToString

func (vb VolumeBinding) ToString(normalize bool) (volume string)

ToString returns volume string

func (VolumeBinding) Validate

func (vb VolumeBinding) Validate() error

Validate return error if invalid Please note: we allow negative value for SizeInBytes, because Realloc uses negative value to descrease the size of volume.

type VolumeBindings

type VolumeBindings []*VolumeBinding

func MergeVolumeBindings

func MergeVolumeBindings(vbs1 VolumeBindings, vbs2 ...VolumeBindings) (ans VolumeBindings)

MergeVolumeBindings combines two VolumeBindings

func NewVolumeBindings

func NewVolumeBindings(volumes []string) (volumeBindings VolumeBindings, err error)

NewVolumeBindings return VolumeBindings of reference type

func RemoveEmptyVolumeBinding

func RemoveEmptyVolumeBinding(vbs VolumeBindings) VolumeBindings

func (VolumeBindings) MarshalJSON

func (vbs VolumeBindings) MarshalJSON() ([]byte, error)

MarshalJSON is used for encoding/json.Marshal

func (VolumeBindings) TotalSize

func (vbs VolumeBindings) TotalSize() int64

func (*VolumeBindings) UnmarshalJSON

func (vbs *VolumeBindings) UnmarshalJSON(b []byte) (err error)

func (VolumeBindings) Validate

func (vbs VolumeBindings) Validate() error

Validate .

type WorkloadResource

type WorkloadResource struct {
	Volumes VolumeBindings `json:"volumes" mapstructure:"volumes"`
	// contains filtered or unexported fields
}

WorkloadResource indicate RBD workload resource

func NewWorkloadResoure

func NewWorkloadResoure() *WorkloadResource

func (*WorkloadResource) DeepCopy

func (w *WorkloadResource) DeepCopy() *WorkloadResource

func (*WorkloadResource) Parse

func (w *WorkloadResource) Parse(rawParams resourcetypes.RawParams) error

ParseFromRawParams .

func (*WorkloadResource) Size

func (w *WorkloadResource) Size() int64

type WorkloadResourceRequest

type WorkloadResourceRequest struct {
	Volumes VolumeBindings `json:"volumes" mapstructure:"volumes"`
}

WorkloadResourceRaw includes all possible fields passed by eru-core for editing workload for request calculation

func (*WorkloadResourceRequest) DeepCopy

func (*WorkloadResourceRequest) Parse

func (w *WorkloadResourceRequest) Parse(rawParams resourcetypes.RawParams) (err error)

Parse .

func (*WorkloadResourceRequest) Validate

func (w *WorkloadResourceRequest) Validate() error

Validate .

Jump to

Keyboard shortcuts

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