Documentation
¶
Index ¶
- Constants
- func IsValidNodeType(nodeType string) bool
- func IsValidProfile(profile string) bool
- func SupportedNodeTypes() []string
- func SupportedProfiles() []string
- type BaselineRequirements
- type DefaultHostProfile
- func (d *DefaultHostProfile) GetAvailableMemoryGB() uint64
- func (d *DefaultHostProfile) GetCPUCores() uint
- func (d *DefaultHostProfile) GetHDDStorageGB() uint64
- func (d *DefaultHostProfile) GetOSVendor() string
- func (d *DefaultHostProfile) GetOSVersion() string
- func (d *DefaultHostProfile) GetSSDStorageGB() uint64
- func (d *DefaultHostProfile) GetTotalMemoryGB() uint64
- func (d *DefaultHostProfile) GetTotalStorageGB() uint64
- func (d *DefaultHostProfile) IsNodeAlreadyRunning() bool
- func (d *DefaultHostProfile) String() string
- type HostProfile
- type Spec
Constants ¶
const ( OSUbuntu18 = "Ubuntu 18" OSDebian10 = "Debian 10" )
Supported OS constants
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 ¶
IsValidNodeType checks if the given node type is supported
func IsValidProfile ¶
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 // Total storage (used when SSD/HDD split not required)
MinSSDStorageGB int // Minimum SSD/NVMe storage (0 means not required)
MinHDDStorageGB int // Minimum HDD storage (0 means not required)
MinSupportedOS []string
}
func GetRequirements ¶
func GetRequirements(nodeType, profile string) (BaselineRequirements, bool)
GetRequirements returns the hardware requirements for a given node type and profile. Returns the requirements and true if found, or empty requirements and false if not found.
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) GetHDDStorageGB ¶
func (d *DefaultHostProfile) GetHDDStorageGB() uint64
GetHDDStorageGB returns total HDD (spinning disk) storage in GB
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) GetSSDStorageGB ¶
func (d *DefaultHostProfile) GetSSDStorageGB() uint64
GetSSDStorageGB returns total SSD/NVMe storage in GB
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
GetSSDStorageGB() uint64 // NVMe/SSD storage
GetHDDStorageGB() uint64 // Traditional spinning disk storage
// 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. This function uses a requirements registry that maps (nodeType, profile) combinations to their specific hardware requirements, properly separating the concerns of node type (what kind of node) and profile (deployment environment).
func NewNodeSpec ¶
func NewNodeSpec(nodeType, profile string, hostProfile HostProfile) (Spec, error)
NewNodeSpec creates a node specification for the given node type, profile, and host profile. Requirements are looked up from the registry based on (nodeType, profile).