Documentation
¶
Index ¶
- Constants
- func BlocksDuringUpdate(path string) bool
- func UpgradePath(current, target string, releases []Release) []string
- type Agent
- type AgentClient
- func (c *AgentClient) Apply(ctx context.Context, request ApplyRequest) (ApplyResponse, error)
- func (c *AgentClient) ApplyPrepared(ctx context.Context, request ApplyRequest) (ApplyResponse, error)
- func (c *AgentClient) Cancel(ctx context.Context) error
- func (c *AgentClient) Prepare(ctx context.Context, request PrepareRequest) (ApplyResponse, error)
- func (c *AgentClient) Status(ctx context.Context) (AgentStatus, error)
- type AgentStatus
- type ApplyRequest
- type ApplyResponse
- type Checker
- type Coordinator
- func (c *Coordinator) Finish(jobID, state, message string, finished bool)
- func (c *Coordinator) Handle(w http.ResponseWriter, r *http.Request)
- func (c *Coordinator) HandleApply(w http.ResponseWriter, r *http.Request)
- func (c *Coordinator) HandleApplyNow(w http.ResponseWriter, _ *http.Request)
- func (c *Coordinator) HandleCancel(w http.ResponseWriter, r *http.Request)
- func (c *Coordinator) HandleInfo(w http.ResponseWriter, r *http.Request)
- func (c *Coordinator) HandlePrepare(w http.ResponseWriter, _ *http.Request)
- func (c *Coordinator) HandleRollback(w http.ResponseWriter, r *http.Request)
- func (c *Coordinator) Mutate(jobID string, mutate func(*Job)) bool
- func (c *Coordinator) ReplaceJob(job *Job)
- func (c *Coordinator) Snapshot() *Job
- type GitHubReleaseSource
- type Info
- type Job
- type PrepareRequest
- type PreparedAgent
- type Release
- type ReleaseChecker
- type ReleaseSource
- type Version
Constants ¶
const AgentProtocolVersion = 2
Variables ¶
This section is empty.
Functions ¶
func BlocksDuringUpdate ¶ added in v0.6.0
func UpgradePath ¶ added in v0.2.12
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 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
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 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 SelectPreviousReleases ¶ added in v0.2.48
func SelectRecentReleases ¶ added in v0.3.2
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.