Help us shape the future of Go! Take the 2026 Go Developer Survey

hostresource

package
v0.4.23 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MiB uint64 = 1 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentEstimate

type ComponentEstimate struct {
	Name           string     `json:"name"`
	MinimumBytes   uint64     `json:"minimum_bytes,omitempty"`
	EstimatedBytes uint64     `json:"estimated_bytes,omitempty"`
	Confidence     Confidence `json:"confidence"`
	Source         string     `json:"source,omitempty"`
}

type Confidence

type Confidence string
const (
	ConfidenceExplicit      Confidence = "EXPLICIT"
	ConfidenceKnownBaseline Confidence = "KNOWN_BASELINE"
	ConfidenceEstimated     Confidence = "ESTIMATED"
	ConfidenceUnknown       Confidence = "UNKNOWN"
)

type Decision

type Decision string
const (
	DecisionSafe   Decision = "SAFE"
	DecisionTight  Decision = "TIGHT"
	DecisionUnsafe Decision = "UNSAFE"
)

type MemoryEstimate

type MemoryEstimate struct {
	MinimumBytes   uint64              `json:"minimum_bytes"`
	EstimatedBytes uint64              `json:"estimated_bytes"`
	Confidence     Confidence          `json:"confidence"`
	Components     []ComponentEstimate `json:"components,omitempty"`
}

func EstimateApplication

func EstimateApplication(m application.Manifest) MemoryEstimate

func EstimateControlPlane

func EstimateControlPlane(ha bool) (MemoryEstimate, error)

EstimateControlPlane accounts for every service in the shipped HA topology. These per-role planning budgets are estimates, not measured RSS baselines.

func EstimateCore added in v0.4.23

func EstimateCore(ha bool, existing map[string]bool) (MemoryEstimate, error)

EstimateCore preserves existing SQL/Secrets planning estimates. Identity is explicitly UNKNOWN until the complete shipped realization is measured (#549).

func Sum

func Sum(components []ComponentEstimate) MemoryEstimate

type MemoryEvidence

type MemoryEvidence struct {
	TotalBytes     uint64   `json:"total_bytes"`
	AvailableBytes uint64   `json:"available_bytes"`
	SwapTotalBytes uint64   `json:"swap_total_bytes"`
	SwapFreeBytes  uint64   `json:"swap_free_bytes"`
	Pressure       Pressure `json:"pressure"`
}

func ReadLinux

func ReadLinux() (MemoryEvidence, error)

type Policy

type Policy struct {
	SafetyMarginBytes  uint64
	PressureSomeAvg300 float64
	PressureFullAvg300 float64
	SwapFreeRatioTight float64
}

func DefaultPolicy

func DefaultPolicy() Policy

type Pressure

type Pressure struct {
	Available  bool    `json:"available"`
	SomeAvg300 float64 `json:"some_avg300,omitempty"`
	FullAvg300 float64 `json:"full_avg300,omitempty"`
}

type Result

type Result struct {
	Evidence MemoryEvidence `json:"evidence"`
	Estimate MemoryEstimate `json:"estimate"`
	Decision Decision       `json:"decision"`
	Reasons  []string       `json:"reasons,omitempty"`
}

func Evaluate

func Evaluate(evidence MemoryEvidence, estimate MemoryEstimate, policy Policy) Result

Jump to

Keyboard shortcuts

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