Documentation
¶
Overview ¶
Package versionstatus combines local identity, active Gateway reports and shared update-check state without caching comparisons against Gateway nodes.
Index ¶
- type ComponentView
- type GatewayView
- type Service
- func (s *Service) Check(ctx context.Context) (Updates, error)
- func (s *Service) Close()
- func (s *Service) Enabled() bool
- func (s *Service) Report(ctx context.Context, node versionregistry.Node) error
- func (s *Service) Start()
- func (s *Service) Summary(ctx context.Context, canManage, canUpgrade bool) (Summary, error)
- func (s *Service) Updates(ctx context.Context) (Updates, error)
- type Summary
- type Updates
- type UpgradeCandidate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComponentView ¶
type ComponentView struct {
Component string `json:"component"`
Current string `json:"current"`
Latest string `json:"latest,omitempty"`
State string `json:"state"`
Count int `json:"count,omitempty"`
Source updatecheck.SourceState `json:"source"`
}
type GatewayView ¶
type GatewayView struct {
Status string `json:"status"`
Scope string `json:"scope"`
Groups []versionregistry.Group `json:"groups"`
}
GatewayView exposes aggregate versions only, never node identities.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(identity productversion.Identity, store versionregistry.Store, checker *updatecheck.Checker, scope string) *Service
New borrows store and owns only the supplied checker's lifecycle. Construction never starts background work or contacts a source.
func (*Service) Check ¶
Check uses the checker's instance-wide manual cooldown and in-flight request. Per-source failures remain in the returned component states.
func (*Service) Close ¶
func (s *Service) Close()
Close is idempotent and never closes the store's borrowed Redis client.
func (*Service) Enabled ¶ added in v1.0.1
Enabled reports the effective online-check state from the checker snapshot. The upgrade flow reuses this single switch: when checks are off, no task that needs external validation or download may be created.
type Summary ¶
type Summary struct {
Identity productversion.Identity `json:"identity"`
Gateway GatewayView `json:"gateway"`
CanManageUpdates bool `json:"can_manage_updates"`
// CanManageUpgrades is the separate upgrade-execution capability. It is
// never implied by CanManageUpdates.
CanManageUpgrades bool `json:"can_manage_upgrades"`
// UpgradeCandidate is the cached standalone target an upgrade-only role may
// confirm. It is filled only when that role lacks update-management access,
// and only from a fresh ready candidate. It never contacts update sources.
UpgradeCandidate *UpgradeCandidate `json:"upgrade_candidate,omitempty"`
}
Summary is the local identity and currently observed Gateway distribution. Update-source details are deliberately absent from this view.
type Updates ¶
type Updates struct {
Enabled bool `json:"enabled"`
Components []ComponentView `json:"components"`
RetryAfterSeconds int `json:"retry_after_seconds"`
}
func Compose ¶
func Compose(identity productversion.Identity, groups []versionregistry.Group, state updatecheck.CheckResult) Updates
Compose compares the supplied current builds with fresh, ready candidates. Gateway groups must represent active reports at the time of the read.
type UpgradeCandidate ¶ added in v1.0.1
type UpgradeCandidate struct {
Version string `json:"version"`
ReleaseURL string `json:"release_url,omitempty"`
}
UpgradeCandidate is the minimum cached target the upgrade page needs when it cannot read the update-management snapshot.