update

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 41 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

Overview

Package update is icebath updating itself: the look for a newer version of the channel an install follows, the update that puts it in place by a release or by the source checkout the program was built in, the other icebath processes of the install handed over to it, the records each update leaves, and what the new program owes at its first start

Index

Constants

View Source
const (
	Stable = "stable"
	Main   = "main"
)

Channels every install has: the latest stable release, and the newest build of the main branch

View Source
const (
	// Under way, or ended with no word, which a later look marks interrupted
	Going = "running"
	// The new program is in place and nothing is owed
	Success = "success"
	// The new program is in place and something is owed: a step after it, or what the person does
	Partial = "partial"
	// Nothing changed, or only what the reason says
	FailedOutcome = "failed"
	// The install does not update itself
	Refused = "refused"
	// The process ended part way
	Interrupted = "interrupted"
	// The channel's build can't read what this build wrote, so the install stays on this build
	Held = "held"
	// There was nothing newer to put in place
	Current = "current"
)

How an update ended

View Source
const (
	// A newer version of the channel was found
	Offered = "offered"
	// An update began in this process
	Started = "started"
	// A step of the update going on in this process
	Stepped = "step"
	// The new program is in place
	Changed = "changed"
	// The update is over
	Done = "done"
	// The update failed, nothing changed or only what it says
	Failed = "failed"
	// An update of another process told this process something: to wait, to end, or what it put in place
	Heard = "heard"
	// The new program ran for the first time and settled what the update owed
	Completed = "completed"
)

Kinds of events

View Source
const StepRestart = "restart"

Step of what an update asks of the person or owes when a process of the install runs the old version until it is started again

Variables

This section is empty.

Functions

func ForgetRecords

func ForgetRecords(cfg *config.Config, ids []string) error

Forgets the records of installs, by id

func Publish

func Publish(dir string, p Published) ([]string, error)

Writes into the channel archive at the folder the build a release published to a channel: its manifest under channel-builds, the head of the channel's record moved to it (the record made when the channel has none), and the index of every channel of the archive. Each file is read back as an install reads it before it is written, and a head never moves back. The files written, slash separated below the folder, which the pipeline signs

func PublishedTo

func PublishedTo(tag string) (string, int64, bool)

Channel and place in it a release tag publishes to, vX.Y.Z-<channel>.<sequence>; false for a stable tag, a build of main, whose releases GitHub lists, and any other tag

func Shared

func Shared() string

Folder the updates of this process's install share with its other processes

func Version

func Version() []string

What /version says: the build, how this icebath came here and what the last look for a newer one found, read from disk

Types

type Backed

type Backed struct {
	Snapshot string   `json:"snapshot,omitempty"`
	Archive  string   `json:"archive,omitempty"`
	Problems []string `json:"problems,omitempty"`
}

What was kept before the update

type Channel

type Channel struct {
	Name, Title, About string
	// Retired into another, which it names
	Into string
}

One channel a person may pick

type Event

type Event struct {
	Kind string
	// What happened, in a sentence or two a person reads
	Text string
	// Version it concerns, such as the one found or installed
	Version string
	// Update it is of, empty for none
	Update string
	// Deadline it speaks of, such as when a window closes, zero for none
	Until time.Time
	At    time.Time
}

What befalls the updates of an install, as the windows follow it

type Followup

type Followup struct {
	Step   string    `json:"step"`
	Reason string    `json:"reason"`
	Retry  string    `json:"retry,omitempty"`
	At     time.Time `json:"at"`
}

Something an update owes after its change, and what retries it

type Handed

type Handed struct {
	PID        int    `json:"pid"`
	Purpose    string `json:"purpose"`
	Profile    string `json:"profile"`
	Supervisor string `json:"supervisor,omitempty"`
	// What the update wanted of it, how it answered, and what came of it in the end
	Want    string `json:"want"`
	Answer  string `json:"answer,omitempty"`
	Outcome string `json:"outcome,omitempty"`
}

One other icebath process of the install and what became of it in the update

type Offer

type Offer struct {
	Checked time.Time `json:"checked"`
	// What went wrong when the look failed, empty when it worked
	Failure string `json:"failure,omitempty"`
	// Build that looked, which a look of another build does not stand for
	Build   string `json:"build"`
	Commit  string `json:"commit,omitempty"`
	Channel string `json:"channel,omitempty"`
	// What the channel delivers: its version, tag, commit, when it was published and its page
	Version   string    `json:"version,omitempty"`
	Tag       string    `json:"tag,omitempty"`
	Target    string    `json:"target,omitempty"`
	Published time.Time `json:"published,omitzero"`
	Page      string    `json:"page,omitempty"`
	// An update would put it in place, moving back doing so; commits it has that this build lacks, -1 when not known
	Moves bool `json:"moves"`
	Back  bool `json:"back,omitempty"`
	Ahead int  `json:"ahead"`
	// Why this build stays, and the words of what updates an install that does not update itself
	Waits    string `json:"waits,omitempty"`
	Updating string `json:"updating,omitempty"`
}

What the last look for a newer version found

func (Offer) Newer

func (o Offer) Newer() bool

Whether there is something newer for the install to take

func (Offer) Said

func (o Offer) Said() string

What the offer says, a sentence or two a person reads

type Options

type Options struct {
	// Channel to follow for this update alone, empty for the install's
	Channel string
	// Branch whose newest build to take for this update alone, of a checkout the branch to bring in
	Branch string
	// What the backup before it takes, empty for what the settings of backups say: off, snapshot or full
	Backup string
	// Go ahead without asking first, though windows close, a server stops or the install moves back
	Yes bool
	// Leave the servers a service manager runs on the old program
	NoRestart bool
	// A checkout on another branch switches to the branch of its channel this time, whatever the settings say
	SwitchBranch bool
	// Changes set aside in a checkout stay set aside, for the person to put back
	KeepStash bool
	// How it was asked for: screen, slash, chat or service; and the profile of who asked
	By, Profile string
}

What one update is asked to do beyond what the settings say, the words alpha's icebath update took as flags

type Plan

type Plan struct {
	Install install.Install
	// The running build
	Build install.Build
	Route string
	// Why the install does not update itself, empty when it does
	Refusal   string
	Following following
	// Channel the target is of, and the one asked for when that one is retired into it
	Channel, Retired string
	// Repository its releases come from
	Repository string
	Target     Target
	// Order of the target against the running build: 1 newer, 0 the same, -1 older; commits it has that the running build lacks, -1 when
	// not known
	Order, Ahead int
	// The update puts the target in place, and moves back to an older one doing so
	Moves, Back bool
	// Why it stays on this build when it does not move, empty when it moves or there is nothing newer
	Waits string
	// How the new program is checked
	Checked string
	// Head of a channel of the archive it read, which a later read may never name older
	Sequence int64
}

What an update would do, decided without changing anything

func (*Plan) Said

func (p *Plan) Said() []string

What the plan says, a line each

type Progress

type Progress struct {
	// A line said: a step done, a warning
	Line string
	// What goes on now, said in place of the status before it
	Status string
}

A step of an update as the one who asked hears it

type Published

type Published struct {
	// Channel and place in it the release's tag names, vX.Y.Z-<channel>.<sequence>
	Channel  string
	Sequence int64
	// Tag of the release and the 40 hex digit commit it was built from
	Tag, Commit string
	// Repository of the release as owner/name
	Repository string
}

A build a release published to a channel of the channel archive, as the release pipeline tells it

type Question

type Question struct {
	Text string
}

What the person must agree to before the update goes ahead, which /update --yes, or the same answer on the screen, gives

func (*Question) Error

func (q *Question) Error() string

type Receipt

type Receipt struct {
	ID      string `json:"id"`
	Install string `json:"install"`
	Program string `json:"program"`
	PID     int    `json:"pid"`
	// How it was asked for: the screen, a slash command in a session or a chat, or a program over the service
	By      string    `json:"by"`
	Profile string    `json:"profile"`
	Started time.Time `json:"started"`
	// When it ended, and when the new program first ran and settled what the update owed
	Finished  time.Time `json:"finished,omitzero"`
	Completed time.Time `json:"completed,omitzero"`
	Outcome   string    `json:"outcome"`
	// Why it ended as it did, in a sentence
	Reason  string         `json:"reason,omitempty"`
	Route   string         `json:"route,omitempty"`
	Channel string         `json:"channel,omitempty"`
	From    install.Build  `json:"from"`
	To      *install.Build `json:"to,omitempty"`
	// Release or commit it put in place
	Target string `json:"target,omitempty"`
	// How the new program was checked
	Checked   string     `json:"checked,omitempty"`
	Backup    *Backed    `json:"backup,omitempty"`
	Steps     []Step     `json:"steps"`
	Followups []Followup `json:"followups,omitempty"`
	// What the person has to do, such as start a server again that no service manager runs
	Actions   []Followup `json:"actions,omitempty"`
	Processes []Handed   `json:"processes,omitempty"`
}

One update of an install as its receipt keeps it, written as it begins and again at each step, so one killed part way shows how far it got

type Stale

type Stale struct {
	ID, Path, Channel string
	// Why it is stale, in a sentence
	Why string
}

A record of an install that is no more: its folder is gone, or holds no program of icebath

func StaleRecords

func StaleRecords(cfg *config.Config) []Stale

Records of installs that are no more, by id

type Standing

type Standing struct {
	Build   install.Build
	Install install.Install
	// Id of the install, as its channel record and its shared folder name it
	ID string
	// Channel it follows, whether a person chose it, and where it was chosen
	Channel string
	Chosen  bool
	From    string
	Route   string
	// Why the install does not update itself, empty when it does
	Refusal string

	// What the last look found, false when it never looked
	Offer   Offer
	Offered bool
	// The update going on now in this process or another, as it says itself; empty when none
	Going string
	// The last update, nil when none is kept
	Last *Receipt
	// Steps the last update still owes, and why each failed last or waits for the computer to be plugged in
	Owed     []string
	Failures map[string]string
	// What an update left part way, empty when nothing
	Interrupted string
	// How a release is checked
	Checked string
	// The look for new versions is on
	Looking bool
	// contains filtered or unexported fields
}

How the updates of the install stand, as the Update page, the status and the doctor read them

func (Standing) Unwritable

func (s Standing) Unwritable() bool

Whether the install would update itself but can't write the folder of its program

type Step

type Step struct {
	Name   string    `json:"name"`
	OK     bool      `json:"ok"`
	Detail string    `json:"detail,omitempty"`
	At     time.Time `json:"at"`
}

One step of an update and how it went

type Target

type Target struct {
	// Version as a person reads it, the tag, the commit, and the branch a checkout brings in
	Version, Tag, Commit, Branch string
	Published                    time.Time
	// Page of the release, where its notes are, and whether it is a prerelease
	Page       string
	Prerelease bool
	// contains filtered or unexported fields
}

A release or a commit an update would put in place

type Updater

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

The updates of the install this process runs: the look for new versions, one update at a time, their records and what they owe

func New

func New(cfg *config.Config, pk *packages.Packages, bk *backup.Backup) *Updater

func (*Updater) Apply

func (u *Updater) Apply(ctx context.Context, opts Options, tell func(Progress)) (*Receipt, error)

Updates icebath to the newest build of its channel, each step told as it happens: the plan, the new program fetched and checked, the hold of one that can't read what this build wrote, the backup, the other processes of the install handed over, the swap, the servers started again, the receipt. A Question when the update would move back or close processes and the options don't say yes; an error a person reads when it can't go ahead, with nothing changed but what it says. The receipt of the update, nil when none was begun

func (*Updater) Attend

func (u *Updater) Attend(here *install.Presence)

Knows this process among the icebath processes of this user, and starts the work of the updates of its install: what an earlier update left part way or still owes, or what a program put in place without one owes, then the look for a newer version every little while, and what other updates tell this process passed on to its windows

func (*Updater) Channels

func (u *Updater) Channels(ctx context.Context) ([]Channel, string)

What a person may pick to follow: stable and main, then the channels the archive lists; why the archive could not be read, empty when it was

func (*Updater) Check

func (u *Updater) Check(ctx context.Context) (Offer, error)

Looks for a newer version of the install's channel now, keeping what it found for the windows and the next looks; an install that does not update itself looks for the newest stable release and says what updates it

func (*Updater) Close

func (u *Updater) Close() error

Stops the work of the updates, waiting for it; an update going on in this process ends with what it was doing undone where it can be

func (*Updater) Current

func (u *Updater) Current() (Receipt, bool)

The update going on in this process, false when none

func (*Updater) Follow

func (u *Updater) Follow(ctx context.Context) <-chan Event

Follows what befalls the updates until the context ends, when the channel closes

func (*Updater) History

func (u *Updater) History() []Receipt

Updates of the install kept, newest first

func (*Updater) Interrupted

func (u *Updater) Interrupted() (string, bool)

Whether something an update left part way waits to be settled: a swap journal, or a receipt of an update under way that nothing runs

func (*Updater) Log

func (u *Updater) Log() string

File of the log of the updates of the settings folder

func (*Updater) Offered

func (u *Updater) Offered() (Offer, bool)

What the last look of this build found, false when it never looked or another build did

func (*Updater) Owed

func (u *Updater) Owed() (steps []string, why map[string]string, update string)

What the install owes, for the doctor and the status: the steps by what they do, and why each failed last or waits for the computer to be plugged in

func (*Updater) Plan

func (u *Updater) Plan(ctx context.Context, opts Options) (*Plan, error)

What an update would do now, changing nothing; a plan with a refusal for an install that does not update itself, an error a person reads when what the channel delivers can't be found

func (*Updater) Receipt

func (u *Updater) Receipt(id string) (Receipt, bool)

The update of the id, or the one whose id starts with it; false when none or several

func (*Updater) Recover

func (u *Updater) Recover() (string, error)

Settles now what an earlier update left part way, as the doctor's repair asks; what it did, in a sentence

func (*Updater) SetChannel

func (u *Updater) SetChannel(name string) (string, error)

Keeps the channel this install follows from now on, refusing an install whose updates are not icebath's; what to know of the change

func (*Updater) Settle

func (u *Updater) Settle(ctx context.Context) ([]string, error)

Settles what is owed now, whatever the waits between tries, as the doctor's repair asks; what is still owed

func (*Updater) Standing

func (u *Updater) Standing() Standing

How the updates of the install stand now, read from disk without looking anything up

func (*Updater) Sudoing

func (u *Updater) Sudoing(sudo func(ctx context.Context, cfg *config.Config, argv []string) ([]string, string, error))

Hands the updater what runs a program with sudo as it can run here, such as a restart of a server the system's own service manager runs, asking the sudo password of whoever sits at a window where sudo needs one

func (*Updater) Told

func (u *Updater) Told() (Event, bool)

What was told this process last by an update of another, as an event; false when nothing was

Directories

Path Synopsis
Page of Updates in the settings menu: the build that runs and how it came here, the channel it follows, what the last look for a newer version found, the update itself step by step, the updates kept, and the settings of updates
Page of Updates in the settings menu: the build that runs and how it came here, the channel it follows, what the last look for a newer version found, the update itself step by step, the updates kept, and the settings of updates
internal
archive command
Command archive writes into the channel archive of the repository the build a release published to a channel, as the self-update reads the archive: the release workflow runs it in the checkout of main once the release of a tag vX.Y.Z-<channel>.<sequence> is out, then signs each file it names on its output and commits them.
Command archive writes into the channel archive of the repository the build a release published to a channel, as the self-update reads the archive: the release workflow runs it in the checkout of main once the release of a tag vX.Y.Z-<channel>.<sequence> is out, then signs each file it names on its output and commits them.

Jump to

Keyboard shortcuts

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