Documentation
¶
Overview ¶
Package updatecheck periodically checks the configured update channel's latest release against the running build, when an operator has opted into auto-update checking (update_settings.auto_update_enabled, migrations/0258_update_settings.sql). It only checks and records the result; it never applies an update itself.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Channel string
CurrentVersion string
LatestVersion string
UpdateAvailable bool
ReleaseURL string
CheckedAt time.Time
}
Result is the outcome of the most recently completed check.
type Scheduler ¶
type Scheduler struct {
Store Store
Fetchers upgrade.Fetchers
Logger *slog.Logger
// contains filtered or unexported fields
}
Scheduler checks, on its own tick, whether update_settings has auto-update enabled and, if so, fetches the configured channel's latest release via Fetchers (internal/upgrade), the identical lookup+comparison logic GET /api/v1/updates itself uses (internal/api/updates.go's handleGetUpdates). Run's own tick-forever shape mirrors backup.Scheduler.Run/alerting.Engine.Run.
func NewScheduler ¶
NewScheduler builds a Scheduler ready to Tick or Run. logger defaults to slog.Default() if nil, the same convention backup.NewScheduler already establishes.
func (*Scheduler) Result ¶
Result returns the outcome of the last completed check, the zero Result if none has run yet (or auto-update has never been enabled).
func (*Scheduler) Tick ¶
Tick reads update_settings and, only when auto_update_enabled is set, fetches the configured channel's latest release and records it. A disabled setting is not an error: Tick is simply a no-op until an operator opts in, the same "absence is a real, valid state" stance this codebase takes elsewhere (e.g. IngressSettings.PrimaryDomain).
type Store ¶
type Store interface {
GetUpdateSettings(ctx context.Context) (store.UpdateSettings, error)
}
Store is the narrow store surface Scheduler needs. *store.DB satisfies this structurally, the same "consumer defines its own narrow interface" convention internal/backup.ScheduleStore already establishes for its own store dependency.