upgrade

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package upgrade is `funcd upgrade` (ADR-0207 Decision 1): the installed binary checks the new one, stops the unit, writes a pre-upgrade generation of the three stores that it can restore itself, swaps the binary keeping <self>.previous, records the upgrade for safe mode and starts the unit again.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Snapshot

func Snapshot(ctx context.Context, cfg config.Config) (backup.Manifest, error)

Snapshot is steps 2 and 4 alone: it writes a pre-upgrade generation of cfg's stores. An empty metastore directory is fault.Invalid; a store or the file:// lock held by a running daemon is fault.Conflict naming its directory; every return after step 4 began re-owns what root wrote (Decision 1, Owner).

Types

type Options

type Options struct {
	Config     config.Config
	NewBinary  string
	Self       string
	Unit       string
	NoSnapshot bool
	Systemctl  func(args ...string) ([]byte, error)
	Out        io.Writer
	// contains filtered or unexported fields
}

Options configure Run. Self is the installed binary (os.Executable, symlinks resolved); Unit "" runs no systemctl; Systemctl runs `systemctl <args>` and returns its standard output.

type Result

type Result struct {
	From, To      string
	Pin           *backup.GenRef
	PastRetention []backup.Entry
}

Result is what Run did: the versions, the pre-upgrade generation (nil with --no-snapshot) and the complete pre-upgrade generations past backup.retention.preUpgrade, oldest first.

func Run

func Run(ctx context.Context, o Options) (Result, error)

Run is Decision 1's steps in order; a failure stops at once. A failure after the stop starts the unit again on the old binary; one after the swap is reported and the swap stands.

Jump to

Keyboard shortcuts

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