update

package
v0.7.44 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AgentProtocolVersion = 2

Variables

This section is empty.

Functions

func BlocksDuringUpdate added in v0.6.0

func BlocksDuringUpdate(path string) bool

func UpgradePath added in v0.2.12

func UpgradePath(current, target string, releases []Release) []string

UpgradePath lists every stable release strictly between current and target, in ascending order, so the console can show what a direct update passes over. Versions the release list does not cover are silently skipped.

Types

type Agent

type Agent interface {
	Status(context.Context) (AgentStatus, error)
	Apply(context.Context, ApplyRequest) (ApplyResponse, error)
}

type AgentClient

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

func NewHTTPAgentClient

func NewHTTPAgentClient(baseURL, token string) *AgentClient

func NewUnixAgentClient

func NewUnixAgentClient(socketPath string) *AgentClient

func (*AgentClient) Apply

func (c *AgentClient) Apply(ctx context.Context, request ApplyRequest) (ApplyResponse, error)

func (*AgentClient) ApplyPrepared added in v0.2.44

func (c *AgentClient) ApplyPrepared(ctx context.Context, request ApplyRequest) (ApplyResponse, error)

func (*AgentClient) Cancel added in v0.2.47

func (c *AgentClient) Cancel(ctx context.Context) error

func (*AgentClient) Prepare added in v0.2.44

func (c *AgentClient) Prepare(ctx context.Context, request PrepareRequest) (ApplyResponse, error)

func (*AgentClient) Status

func (c *AgentClient) Status(ctx context.Context) (AgentStatus, error)

type AgentStatus

type AgentStatus struct {
	ProtocolVersion int    `json:"protocol_version"`
	Available       bool   `json:"available"`
	StagedUpdate    bool   `json:"staged_update"`
	Version         string `json:"version,omitempty"`
	State           string `json:"state"`
	JobID           string `json:"job_id,omitempty"`
	CurrentVersion  string `json:"current_version,omitempty"`
	TargetVersion   string `json:"target_version,omitempty"`
	BackupPath      string `json:"backup_path,omitempty"`
	Error           string `json:"error,omitempty"`
	StartedAt       string `json:"started_at,omitempty"`
	FinishedAt      string `json:"finished_at,omitempty"`
}

type ApplyRequest

type ApplyRequest struct {
	CurrentVersion string `json:"current_version"`
	TargetVersion  string `json:"target_version"`
	BackupPath     string `json:"backup_path"`
	SkipPull       bool   `json:"skip_pull,omitempty"`
}

type ApplyResponse

type ApplyResponse struct {
	JobID string `json:"job_id"`
}

type Checker

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

func NewChecker

func NewChecker(currentVersion string, source ReleaseSource) *Checker

func (*Checker) Check

func (c *Checker) Check(ctx context.Context, force bool) (Info, error)

type Coordinator added in v0.6.0

type Coordinator struct {
	Checker ReleaseChecker
	Agent   Agent
	Backup  func(context.Context, string, int) (accounts.Backup, error)
	DataDir string

	Maintenance atomic.Bool
	Running     atomic.Bool

	Job *Job
	// contains filtered or unexported fields
}

Coordinator dependencies are injected before serving requests and must not be replaced while requests or background update tasks are running.

func (*Coordinator) Finish added in v0.6.0

func (c *Coordinator) Finish(jobID, state, message string, finished bool)

func (*Coordinator) Handle added in v0.6.0

func (c *Coordinator) Handle(w http.ResponseWriter, r *http.Request)

func (*Coordinator) HandleApply added in v0.6.0

func (c *Coordinator) HandleApply(w http.ResponseWriter, r *http.Request)

func (*Coordinator) HandleApplyNow added in v0.6.0

func (c *Coordinator) HandleApplyNow(w http.ResponseWriter, _ *http.Request)

func (*Coordinator) HandleCancel added in v0.6.0

func (c *Coordinator) HandleCancel(w http.ResponseWriter, r *http.Request)

func (*Coordinator) HandleInfo added in v0.6.0

func (c *Coordinator) HandleInfo(w http.ResponseWriter, r *http.Request)

func (*Coordinator) HandlePrepare added in v0.6.0

func (c *Coordinator) HandlePrepare(w http.ResponseWriter, _ *http.Request)

func (*Coordinator) HandleRollback added in v0.6.0

func (c *Coordinator) HandleRollback(w http.ResponseWriter, r *http.Request)

func (*Coordinator) Mutate added in v0.6.0

func (c *Coordinator) Mutate(jobID string, mutate func(*Job)) bool

func (*Coordinator) ReplaceJob added in v0.6.0

func (c *Coordinator) ReplaceJob(job *Job)

func (*Coordinator) Snapshot added in v0.6.0

func (c *Coordinator) Snapshot() *Job

type GitHubReleaseSource

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

func NewGitHubReleaseSource

func NewGitHubReleaseSource(repo, token string) *GitHubReleaseSource

func (*GitHubReleaseSource) ListReleases

func (s *GitHubReleaseSource) ListReleases(ctx context.Context) ([]Release, error)

type Info

type Info struct {
	CurrentVersion   string    `json:"current_version"`
	NextVersion      string    `json:"next_version,omitempty"`
	SkippedVersions  []string  `json:"skipped_versions,omitempty"`
	RollbackVersions []Release `json:"rollback_versions,omitempty"`
	RecentReleases   []Release `json:"recent_releases,omitempty"`
	HasUpdate        bool      `json:"has_update"`
	Managed          bool      `json:"managed"`
	Cached           bool      `json:"cached"`
	Warning          string    `json:"warning,omitempty"`
	Release          *Release  `json:"release,omitempty"`
}

type Job added in v0.6.0

type Job struct {
	JobID          string `json:"job_id"`
	AgentJobID     string `json:"agent_job_id,omitempty"`
	State          string `json:"state"`
	CurrentVersion string `json:"current_version,omitempty"`
	TargetVersion  string `json:"target_version,omitempty"`
	BackupPath     string `json:"backup_path,omitempty"`
	Error          string `json:"error,omitempty"`
	StartedAt      string `json:"started_at,omitempty"`
	FinishedAt     string `json:"finished_at,omitempty"`
}

type PrepareRequest added in v0.2.44

type PrepareRequest struct {
	CurrentVersion string `json:"current_version"`
	TargetVersion  string `json:"target_version"`
}

type PreparedAgent added in v0.2.44

type PreparedAgent interface {
	Prepare(context.Context, PrepareRequest) (ApplyResponse, error)
	ApplyPrepared(context.Context, ApplyRequest) (ApplyResponse, error)
	Cancel(context.Context) error
}

type Release

type Release struct {
	TagName     string `json:"tag_name"`
	Name        string `json:"name"`
	Body        string `json:"body"`
	PublishedAt string `json:"published_at"`
	HTMLURL     string `json:"html_url"`
	Draft       bool   `json:"draft"`
	Prerelease  bool   `json:"prerelease"`
}

func SelectNextRelease

func SelectNextRelease(current string, releases []Release) (Release, bool)

func SelectPreviousReleases added in v0.2.48

func SelectPreviousReleases(current string, releases []Release, limit int) []Release

func SelectRecentReleases added in v0.3.2

func SelectRecentReleases(current string, releases []Release, limit int) []Release

SelectRecentReleases returns a bounded newest-first history for the System page: the latest update when one exists, the running version, a few older rollback targets, then skipped versions in between. Extra older releases fill remaining slots.

type ReleaseChecker added in v0.6.0

type ReleaseChecker interface {
	Check(context.Context, bool) (Info, error)
}

type ReleaseSource

type ReleaseSource interface {
	ListReleases(context.Context) ([]Release, error)
}

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

func ParseVersion

func ParseVersion(value string) (Version, error)

func (Version) Compare

func (v Version) Compare(other Version) int

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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