rack

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 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 ComponentsOrderBySlotID

type ComponentsOrderBySlotID []component.Component

ComponentsOrderBySlotID is a slice of components that can be sorted by slot ID. It implements sort.Interface and orders components by their Position.SlotID in descending order (higher slot IDs first, from top to bottom in the rack).

func (ComponentsOrderBySlotID) Len

func (s ComponentsOrderBySlotID) Len() int

func (ComponentsOrderBySlotID) Less

func (s ComponentsOrderBySlotID) Less(i, j int) bool

func (ComponentsOrderBySlotID) Swap

func (s ComponentsOrderBySlotID) Swap(i, j int)

type Rack

type Rack struct {
	Info       deviceinfo.DeviceInfo `json:"info"`
	Loc        location.Location     `json:"loc"`
	Components []component.Component `json:"components"`
	// contains filtered or unexported fields
}

Rack represents a hardware rack with various properties and components installed inside. This is not thread safe since it is not really needed. If the caller plans to use this in a concurrent environment, they should wrap it in a sync.RWMutex.

NOTE: The Components field does not necessarily contain ALL components in the rack. Callers should not assume Components is complete - it may contain only a subset of components (e.g., those selected for an operation). Always verify the context in which a Rack object is used.

func New

func New(info deviceinfo.DeviceInfo, loc location.Location) *Rack

New creates a new Rack with the given device info and location.

func (*Rack) AddComponent

func (r *Rack) AddComponent(comp component.Component) int

AddComponent adds a single component to the Rack.

func (*Rack) AddComponents

func (r *Rack) AddComponents(comps []component.Component) int

AddComponents adds multiple components to the Rack.

func (*Rack) IsSealed

func (r *Rack) IsSealed() bool

IsSealed checks if the rack is sealed.

func (*Rack) PatchComponents

func (r *Rack) PatchComponents(components []component.Component) int

PatchComponents patches the components in the rack with the provided components.

func (*Rack) Seal

func (r *Rack) Seal() bool

Seal seal the rack information to make it unchangable.

func (*Rack) String

func (r *Rack) String() string

String returns a string representation of the Rack.

func (*Rack) VerifyIDOrSerial

func (r *Rack) VerifyIDOrSerial() bool

VerifyIDOrSerial verifies the validity of ID or serial information of the components and the rack.

func (*Rack) VerifyIDs

func (r *Rack) VerifyIDs() bool

VerifyIDs verifies the existence of IDs of the components and the rack.

Jump to

Keyboard shortcuts

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