updater

package
v0.4.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubOwner = "flatrun"
	GitHubRepo  = "agent"
	BinaryName  = "flatrun-agent"
)

Variables

This section is empty.

Functions

func RestartService

func RestartService() error

func Rollback

func Rollback() error

Types

type Asset

type Asset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
	Size               int64  `json:"size"`
}

type Availability

type Availability struct {
	CurrentVersion  string        `json:"current_version"`
	Channel         Channel       `json:"channel"`
	LatestVersion   string        `json:"latest_version"`
	UpdateAvailable bool          `json:"update_available"`
	Releases        []ReleaseInfo `json:"releases"`
}

Availability describes the update picture for a channel: the running version, the highest version the channel offers, whether that is an upgrade, and every installable release newest-first.

func ListAvailable

func ListAvailable(channel Channel) (*Availability, error)

ListAvailable returns every release the channel can install, newest-first by semver, so a client can present the choices and their changelogs without reimplementing the channel and ordering rules.

type Channel

type Channel string

Channel selects which releases an update considers. Stable ignores prereleases; Prerelease is the opt-in channel that also sees betas.

const (
	ChannelStable     Channel = "stable"
	ChannelPrerelease Channel = "prerelease"
)

type Release

type Release struct {
	TagName     string  `json:"tag_name"`
	Name        string  `json:"name"`
	Body        string  `json:"body"`
	PublishedAt string  `json:"published_at"`
	Prerelease  bool    `json:"prerelease"`
	Draft       bool    `json:"draft"`
	Assets      []Asset `json:"assets"`
}

type ReleaseInfo

type ReleaseInfo struct {
	Version     string `json:"version"`
	Prerelease  bool   `json:"prerelease"`
	PublishedAt string `json:"published_at"`
	Changelog   string `json:"changelog"`
}

ReleaseInfo is a release presented to a client: the version without its `v` prefix, whether it is a prerelease, when it was published, and its changelog.

type UpdateResult

type UpdateResult struct {
	CurrentVersion  string `json:"current_version"`
	LatestVersion   string `json:"latest_version"`
	UpdateAvailable bool   `json:"update_available"`
	Downloaded      bool   `json:"downloaded"`
	Installed       bool   `json:"installed"`
	Message         string `json:"message"`
}

func CheckForUpdate

func CheckForUpdate(channel Channel) (*UpdateResult, error)

func Update

func Update(force bool, channel Channel) (*UpdateResult, error)

Jump to

Keyboard shortcuts

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