Documentation
¶
Overview ¶
Package config loads flockd configuration from defaults, an optional TOML file, and FLOCKD_-prefixed environment variables (koanf). Every knob is documented in docs/config.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LimitsPath ¶ added in v0.3.0
LimitsPath is the daemon-owned governor-limits overlay location.
func SaveLimits ¶ added in v0.3.0
SaveLimits persists live-edited limits to the overlay file that Load applies on the next start. Only the operator-facing limit knobs are written; poll_interval and the rest stay wherever the operator set them. meshManaged is the [models] switch the same dashboard toggle edits.
Types ¶
type Config ¶
type Config struct {
DataDir string `koanf:"data_dir"`
Log Log `koanf:"log"`
LocalAPI LocalAPI `koanf:"local_api"`
Runtime Runtime `koanf:"runtime"`
Governor Governor `koanf:"governor"`
Budget Budget `koanf:"budget"`
Models Models `koanf:"models"`
Tunnel Tunnel `koanf:"tunnel"`
Enroll Enroll `koanf:"enroll"`
}
Config is the fully resolved daemon configuration.
type Enroll ¶
type Enroll struct {
// LoginURL is the browser URL opened by `tera login`.
LoginURL string `koanf:"login_url"`
}
type Governor ¶
type Governor struct {
// ServePolicy: "always", "idle-only" or "scheduled".
ServePolicy string `koanf:"serve_policy"`
// IdleAfter is how long input must be quiet before the node counts as
// idle (idle-only policy).
IdleAfter time.Duration `koanf:"idle_after"`
// YieldGrace is the drain-or-cancel window on operator activity
// (SPEC §4.1 instant-yield). Default 2s.
YieldGrace time.Duration `koanf:"yield_grace"`
// PollInterval is how often idle/power signals are sampled.
PollInterval time.Duration `koanf:"poll_interval"`
// ServeOnBattery: never serve on battery by default.
ServeOnBattery bool `koanf:"serve_on_battery"`
// MaxTempCelsius pauses serving above this temperature (0 disables).
MaxTempCelsius float64 `koanf:"max_temp_celsius"`
// Schedule windows for serve_policy=scheduled, e.g. ["22:00-08:00"].
Schedule []string `koanf:"schedule"`
}
type LocalAPI ¶
type LocalAPI struct {
// Listen address. Loopback only by default; changing this is dangerous
// and documented with warnings in docs/config.md.
Listen string `koanf:"listen"`
// RequireAuthV1 requires the bearer token on the OpenAI-compatible /v1
// endpoints too (the daemon-management /api/v1 always requires it).
RequireAuthV1 bool `koanf:"require_auth_v1"`
}
type Models ¶
type Models struct {
// ManifestPath or ManifestURL locates the model catalog (YAML/JSON,
// teraflock/models format).
ManifestPath string `koanf:"manifest_path"`
ManifestURL string `koanf:"manifest_url"`
// Default is the model id served in standalone mode.
Default string `koanf:"default"`
// MaxDiskMB is the model-cache disk budget; LRU eviction below it.
MaxDiskMB int64 `koanf:"max_disk_mb"`
// Pin lists model ids exempt from eviction; Exclude are never assigned.
Pin []string `koanf:"pin"`
Exclude []string `koanf:"exclude"`
// MeshManaged lets the coordinator place models on this node (download,
// load, and later evict what it placed) inside max_disk_mb, minus pin
// and exclude. Off = the node serves only what the operator installed.
// Default on: an enrolled node that never takes placements never earns.
MeshManaged bool `koanf:"mesh_managed"`
}
type Runtime ¶
type Runtime struct {
// Kind selects the runtime adapter: "llamacpp" or "mock".
Kind string `koanf:"kind"`
// LlamaServerPath, when set, uses an existing llama-server binary
// instead of downloading one from the artifact manifest.
LlamaServerPath string `koanf:"llama_server_path"`
// ArtifactManifestURL points at the JSON manifest of pinned, SHA-verified
// llama-server builds (see internal/runtime/llamacpp/artifact.go).
ArtifactManifestURL string `koanf:"artifact_manifest_url"`
// MockTokensPerSec controls the synthetic generation speed of the mock
// runtime (tests, --standalone demos).
MockTokensPerSec float64 `koanf:"mock_tokens_per_sec"`
// ContextLength override passed to llama-server (0 = model default).
ContextLength int `koanf:"context_length"`
}
type Tunnel ¶
type Tunnel struct {
// CoordinatorAddr is the coordinator endpoint (host:port).
CoordinatorAddr string `koanf:"coordinator_addr"`
// Standalone runs the in-process fake coordinator (Phase 0).
Standalone bool `koanf:"standalone"`
// HeartbeatInterval between heartbeats (coordinator may override).
HeartbeatInterval time.Duration `koanf:"heartbeat_interval"`
// ReconnectMin/Max bound the jittered exponential backoff.
ReconnectMin time.Duration `koanf:"reconnect_min"`
ReconnectMax time.Duration `koanf:"reconnect_max"`
// InsecureSkipVerify disables server cert verification (dev only).
InsecureSkipVerify bool `koanf:"insecure_skip_verify"`
// Insecure dials the coordinator over plaintext gRPC instead of TLS.
// The dev coordinator (`just run-coordinator`) serves plaintext until
// mTLS termination lands; never enable this against a real deployment.
Insecure bool `koanf:"insecure"`
}