Documentation
¶
Overview ¶
Package machines is Fort's static machine registry and deterministic placement (spec 022). It is pure core data — it imports neither ui nor any exec package — so placement, like routing, takes zero model calls (asserted by TestPlacementIsDeterministic). cmd/fort loads the registry and hands it to the engine as a Placer and to exec/cluster as the transport map.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Live ¶ added in v0.6.0
type Live struct {
// contains filtered or unexported fields
}
Live is a swappable registry shared by the placer, the cluster runtime's wiring, and the roster (spec 024): enrollment stores a new *Registry and every reader sees it immediately. The zero value holds no registry, which behaves exactly like single-machine mode.
func (*Live) Load ¶ added in v0.6.0
Load returns the current registry, or nil when none is installed.
func (*Live) Place ¶ added in v0.6.0
Place implements engine.Placer over the current registry. With no registry installed it preserves single-machine semantics: no placement, but an explicit pin is an error (there is nothing to pin to).
type Machine ¶
type Machine struct {
Name string `yaml:"name" json:"name"`
URL string `yaml:"url" json:"url"`
Agents []string `yaml:"agents" json:"agents"`
}
Machine is one host in the registry: its stable name, the base URL of its Fort HTTP API, and the agents (providers) it can run.
type Registry ¶
type Registry struct {
Version int `yaml:"version" json:"version"`
Machines []Machine `yaml:"machines" json:"machines"`
// contains filtered or unexported fields
}
Registry is a parsed machines.yaml plus this machine's identity.
func Parse ¶
Parse parses machines.yaml and records localName as this machine's identity. localName is matched case-insensitively against the registry and canonicalized to the stored casing (so downstream name comparisons are exact).
func (*Registry) Place ¶
Place chooses, deterministically, the machine that will run agent:
- an explicit pin — must exist and offer the agent, else an error;
- otherwise the local machine, if it offers the agent;
- otherwise the first machine in registry order that offers the agent;
- otherwise an error.
It returns the canonical machine name. Place is a pure function of its inputs and the registry — no model calls (see TestPlacementIsDeterministic).
func (*Registry) WithMachine ¶ added in v0.6.0
WithMachine returns a copy of r with m added, or — when a machine of the same name (case-insensitive) exists — that entry's url and agents replaced. The stored (canonical) casing of an existing name wins. r is not mutated.