versionstatus

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package versionstatus combines local identity, active Gateway reports and shared update-check state without caching comparisons against Gateway nodes.

Index

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

func (s *Service) Check(ctx context.Context) (Updates, error)

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

func (s *Service) Enabled() bool

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.

func (*Service) Report

func (s *Service) Report(ctx context.Context, node versionregistry.Node) error

func (*Service) Start

func (s *Service) Start()

func (*Service) Summary

func (s *Service) Summary(ctx context.Context, canManage, canUpgrade bool) (Summary, error)

func (*Service) Updates

func (s *Service) Updates(ctx context.Context) (Updates, error)

Updates is read-only with respect to external sources. A fresh registry read ensures expired or newly reported Gateway builds immediately affect notices.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL