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) GetOSVendor() string
- func (d *DefaultHostProfile) GetOSVersion() string
- 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 ( // 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
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