updater

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyChecksum

func VerifyChecksum(archivePath, archiveName, checksumsPath string) error

VerifyChecksum checks the SHA256 of archivePath against the checksums file.

Types

type Config

type Config struct {
	CheckInterval time.Duration
	Repo          string // "owner/repo"
	InstallDir    string
	Version       string // updater's own version (used for user-agent)
}

Config holds the updater configuration.

type GitHubAsset

type GitHubAsset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

GitHubAsset represents a release asset.

type GitHubRelease

type GitHubRelease struct {
	TagName string        `json:"tag_name"`
	Assets  []GitHubAsset `json:"assets"`
}

GitHubRelease represents a subset of the GitHub release API response.

type Semver

type Semver struct {
	Major int
	Minor int
	Patch int
}

Semver represents a parsed semantic version.

func ParseSemver

func ParseSemver(s string) (Semver, error)

ParseSemver parses a version string like "v1.2.3" or "1.2.3" or "v1.2.3-dirty". It strips the "v" prefix and any suffix after a hyphen.

func (Semver) NewerThan

func (v Semver) NewerThan(other Semver) bool

NewerThan returns true if v is strictly newer than other.

func (Semver) String

func (v Semver) String() string

String returns the version as "vMAJOR.MINOR.PATCH".

type Service

type Service struct{}

Service is the L11 plugin lifecycle adapter for the updater. The daemon does not register this today — cmd/updater is a standalone binary that uses updater.New / *Updater.Start directly. The adapter exists so the plugin package conforms to the L10 Service contract and so the no_updater build tag has a meaningful counterpart (see service_disabled.go).

When this plugin is eventually wired into cmd/daemon's plugin runtime, this Service will own the *Updater lifecycle. Today its Start/Stop are no-ops; it is registered nowhere.

func NewService

func NewService() *Service

NewService returns a Service ready for daemon.RegisterPlugin (when cmd/daemon eventually starts registering it). Distinct from updater.New, which constructs the standalone *Updater used by cmd/updater.

func (*Service) Name

func (s *Service) Name() string

func (*Service) Order

func (s *Service) Order() int

func (*Service) Start

func (s *Service) Start(_ context.Context, _ coreapi.Deps) error

func (*Service) Stop

func (s *Service) Stop(_ context.Context) error

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater periodically checks GitHub Releases for new versions and optionally applies them.

func New

func New(cfg Config) *Updater

New creates a new Updater.

func (*Updater) Start

func (u *Updater) Start()

Start begins the periodic check loop.

func (*Updater) Stop

func (u *Updater) Stop()

Stop signals the check loop to stop and waits for it to finish.

Jump to

Keyboard shortcuts

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