Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrDisabled = errors.New("update checks disabled") ErrCooldown = errors.New("check cooldown") )
var ErrNoCandidate = errors.New("no stable candidate")
ErrNoCandidate distinguishes a valid response without a stable candidate from a failed check.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
Candidate is a stable release advertised by a controlled publishing channel.
func ParseFormula ¶
ParseFormula reads a single line-start version declaration without executing Ruby. Indentation and trailing comments are allowed; ambiguous or malformed declarations fail the check.
type CheckResult ¶
type CheckResult struct {
Enabled bool `json:"enabled"`
Sources map[string]SourceState `json:"sources"`
RetryAfterSeconds int `json:"retry_after_seconds"`
}
CheckResult is a snapshot of the shared update checks.
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker owns the lifecycle and state shared by automatic and manual checks.
func NewChecker ¶
NewChecker borrows its sources and ties their shared work to ctx, not to the context of an individual caller. Zero durations use the production defaults.
func (*Checker) Check ¶
Check joins an in-flight check before applying the instance-wide manual cooldown. Canceling ctx stops only this caller's wait.
func (*Checker) Close ¶
func (c *Checker) Close()
Close cancels and waits for the scheduler and all registered source work. It never closes a source's borrowed HTTP client.
func (*Checker) Snapshot ¶
func (c *Checker) Snapshot() CheckResult
Snapshot returns an isolated, age-adjusted view without contacting a source.
type Options ¶
type Options struct {
Enabled bool
Interval, Timeout, Cooldown time.Duration
Now func() time.Time
After func(time.Duration) <-chan time.Time
}
Options controls background checks, the shared deadline and manual cooldown.
type Source ¶
Source checks the current candidate without falling back to release history.
func NewGitHubSource ¶
NewGitHubSource uses only the admin or gateway repository's latest release. Unknown components fail locally when checked.
func NewHomebrewSource ¶
NewHomebrewSource uses the currently published Formula, not standalone's latest release, which may have been published before Homebrew was updated.
type SourceState ¶
type SourceState struct {
Status string `json:"status"`
Candidate *Candidate `json:"candidate,omitempty"`
LastAttempt time.Time `json:"last_attempt"`
LastSuccess time.Time `json:"last_success"`
Stale bool `json:"stale"`
ErrorCode string `json:"error_code,omitempty"`
}
SourceState describes the latest attempt and, when present, its candidate. Candidates in stale or non-ready states are history, not actionable targets.