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

strategy

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Auto    = "AUTO"
	Fill    = "FILL"
	Each    = "EACH"
	Global  = "GLOBAL"
	Drained = "DRAINED"
	// Dummy marks a capacity-only request and has no entry in Plans
	Dummy = "DUMMY"
)

Variables

Functions

func AveragePlan

func AveragePlan(_ context.Context, infos []Info, need, _, limit int) (map[string]int, error)

AveragePlan puts need workloads on each of limit nodes; need is per node, limit 0 means every node.

func CommunismPlan

func CommunismPlan(_ context.Context, infos []Info, need, total, limit int) (map[string]int, error)

CommunismPlan spreads need workloads so the global per-node count ends as even as possible.

func Deploy

func Deploy(ctx context.Context, strategy string, count, nodesLimit int, strategyInfos []Info, total int) (map[string]int, error)

Deploy spreads count workloads over strategyInfos by the named plan; a plan may reorder the slice.

func DrainedPlan

func DrainedPlan(_ context.Context, infos []Info, need, total, _ int) (map[string]int, error)

DrainedPlan fills the lowest-capacity nodes first, draining each before moving to the next.

func FillPlan

func FillPlan(_ context.Context, infos []Info, need, _, limit int) (map[string]int, error)

FillPlan tops every node up to need workloads; need is a per-node ceiling, limit 0 means every node.

func GlobalPlan

func GlobalPlan(_ context.Context, infos []Info, need, total, _ int) (map[string]int, error)

GlobalPlan spreads need workloads to keep Usage+Rate as even as possible across nodes.

Types

type Info

type Info struct {
	Nodename string

	Usage float64
	Rate  float64

	Capacity int
	Count    int
}

Jump to

Keyboard shortcuts

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