Documentation
¶
Overview ¶
Package update checks for a newer flockd release. Two sources feed it: the coordinator's release channel (ConfigUpdate.latest_version / minimum_version / release_url — authoritative, the mesh knows the minimum it drains below) and the public version feed (the fallback for nodes without a session, and the source of the URL when the mesh sends none). It never installs anything: it tells the operator (status, SSE, CLI, TUI, desktop banner) and points at the release page. Brew users run `brew upgrade --cask tera`; signed self-update is gated on plan 01.
Index ¶
Constants ¶
const ( SourceFeed = "feed" SourceMesh = "mesh" )
Sources of a Result's versions.
const DefaultFeedURL = "https://api.teraflock.ai/v1/versions"
DefaultFeedURL is the control plane's public version feed.
Variables ¶
ErrFeedUnavailable wraps feed fetch failures (404 while the endpoint is being built, connection errors). The result is "unknown", not an error the operator sees.
Functions ¶
Types ¶
type Checker ¶
type Checker struct {
FeedURL string
// Current is the running build version (main.version).
Current string
Client *http.Client
Log *slog.Logger
// Events receives `update_available` once per newly discovered
// version. May be nil.
Events *events.Hub
// Activity gets an update_available row once per version. May be nil.
Activity *activity.Ring
// InitialDelay before the first check (lets the daemon finish booting)
// and Interval between checks. Zero = 30s / 1h.
InitialDelay time.Duration
Interval time.Duration
// contains filtered or unexported fields
}
Checker polls the feed.
func (*Checker) ApplyMesh ¶ added in v0.5.0
ApplyMesh takes the coordinator's release channel from a ConfigUpdate. Non-empty latest/minimum override the feed's from now on (the mesh is authoritative: it knows the minimum it drains below); url fills in for the feed's only when set. Empty latest and minimum mean the coordinator sent nothing and change nothing. The result is recorded immediately, so status.update.below_minimum flips as soon as the coordinator says so, and a newly discovered version is announced once like a feed result.
type Feed ¶
type Feed struct {
Flockd struct {
Latest string `json:"latest"`
Minimum string `json:"minimum"`
URL string `json:"url"`
} `json:"flockd"`
Desktop struct {
Latest string `json:"latest"`
URL string `json:"url"`
} `json:"desktop"`
}
Feed is the version feed document:
{"flockd":{"latest":"0.4.0","minimum":"0.3.0","url":"…"},
"desktop":{"latest":"…","url":"…"}}
type Public ¶
type Public struct {
Available bool `json:"available"`
Current string `json:"current"`
Latest string `json:"latest"`
Minimum string `json:"minimum,omitempty"`
BelowMinimum bool `json:"below_minimum,omitempty"`
URL string `json:"url,omitempty"`
CheckedAt time.Time `json:"checked_at"`
}
Public is the wire shape shared by /api/v1/status.update, the update/check route and the SSE event (mirrors the Update schema).
type Result ¶
type Result struct {
// Available is true when Latest is a newer release than Current.
// Always false for dev builds (never nag a developer's own binary).
Available bool
Current string
Latest string
Minimum string
BelowMinimum bool
URL string
CheckedAt time.Time
// Source names where Latest/Minimum came from: "mesh" when the
// coordinator's release channel set them, else "feed".
Source string
}
Result is one completed check.