hardware

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// SystemBufferGB defines the memory buffer reserved for system operations (in GB)
	SystemBufferGB = 0.5 // 512MB buffer for system operations
)

Variables

This section is empty.

Functions

func IsValidNodeType

func IsValidNodeType(nodeType string) bool

IsValidNodeType checks if the given node type is supported

func IsValidProfile

func IsValidProfile(profile string) bool

IsValidProfile checks if the given profile is supported

func SupportedNodeTypes

func SupportedNodeTypes() []string

SupportedNodeTypes returns all supported node types

func SupportedProfiles

func SupportedProfiles() []string

SupportedProfiles returns all supported deployment profiles

Types

type BaselineRequirements

type BaselineRequirements struct {
	MinCpuCores    int
	MinMemoryGB    int
	MinStorageGB   int
	MinSupportedOS []string
}

func (BaselineRequirements) String

func (r BaselineRequirements) String() string

type DefaultHostProfile

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

DefaultHostProfile implements HostProfile using both sysinfo and ghw libraries

func (*DefaultHostProfile) GetAvailableMemoryGB

func (d *DefaultHostProfile) GetAvailableMemoryGB() uint64

GetAvailableMemoryGB returns available system memory in GB

func (*DefaultHostProfile) GetCPUCores

func (d *DefaultHostProfile) GetCPUCores() uint

GetCPUCores returns the number of CPU cores

func (*DefaultHostProfile) GetOSVendor

func (d *DefaultHostProfile) GetOSVendor() string

GetOSVendor returns the OS vendor/distribution name

func (*DefaultHostProfile) GetOSVersion

func (d *DefaultHostProfile) GetOSVersion() string

GetOSVersion returns the OS version

func (*DefaultHostProfile) GetTotalMemoryGB

func (d *DefaultHostProfile) GetTotalMemoryGB() uint64

GetTotalMemoryGB returns total system memory in GB

func (*DefaultHostProfile) GetTotalStorageGB

func (d *DefaultHostProfile) GetTotalStorageGB() uint64

GetTotalStorageGB returns total storage space in GB

func (*DefaultHostProfile) IsNodeAlreadyRunning

func (d *DefaultHostProfile) IsNodeAlreadyRunning() bool

IsNodeAlreadyRunning checks if the node is already running by looking for a lock file

func (*DefaultHostProfile) String

func (d *DefaultHostProfile) String() string

type HostProfile

type HostProfile interface {
	// OS information
	GetOSVendor() string
	GetOSVersion() string

	// CPU information
	GetCPUCores() uint

	// Memory information (in GB)
	GetTotalMemoryGB() uint64
	GetAvailableMemoryGB() uint64

	// Storage information (in GB)
	GetTotalStorageGB() uint64

	// Application status
	IsNodeAlreadyRunning() bool

	String() string
}

HostProfile provides an abstraction over system information gathering This interface allows for easier testing and separation of concerns

func GetHostProfile

func GetHostProfile() HostProfile

GetHostProfile creates a new DefaultHostProfile by gathering system information

type Spec

type Spec interface {
	ValidateOS() error
	ValidateCPU() error
	ValidateMemory() error
	ValidateStorage() error

	GetBaselineRequirements() BaselineRequirements
	GetNodeType() string
}

func CreateNodeSpec

func CreateNodeSpec(nodeType string, profile string, hostProfile HostProfile) (Spec, error)

CreateNodeSpec creates the appropriate node spec based on node type, profile and host profile

func NewBlockNodeSpec

func NewBlockNodeSpec(hostProfile HostProfile) Spec

NewBlockNodeSpec creates a new block node specification checker with SystemInfo interface

func NewConsensusNodeSpec

func NewConsensusNodeSpec(hostProfile HostProfile) Spec

NewConsensusNodeSpec creates a new consensus node specification checker with SystemInfo interface

func NewLocalNodeSpec

func NewLocalNodeSpec(hostProfile HostProfile) Spec

NewLocalNodeSpec creates a new local node specification checker with SystemInfo interface

Jump to

Keyboard shortcuts

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