Documentation
¶
Index ¶
- type ComponentsOrderBySlotID
- type Rack
- func (r *Rack) AddComponent(comp component.Component) int
- func (r *Rack) AddComponents(comps []component.Component) int
- func (r *Rack) IsSealed() bool
- func (r *Rack) PatchComponents(components []component.Component) int
- func (r *Rack) Seal() bool
- func (r *Rack) String() string
- func (r *Rack) VerifyIDOrSerial() bool
- func (r *Rack) VerifyIDs() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComponentsOrderBySlotID ¶
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 ¶
AddComponent adds a single component to the Rack.
func (*Rack) AddComponents ¶
AddComponents adds multiple components to the Rack.
func (*Rack) PatchComponents ¶
PatchComponents patches the components in the rack with the provided components.
func (*Rack) VerifyIDOrSerial ¶
VerifyIDOrSerial verifies the validity of ID or serial information of the components and the rack.