update

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package update implements the shared, explicit version inventory behind nova-update and nova-version. It never discovers homes or installs on a verdict.

Index

Constants

View Source
const AdoptHeader = "check\tcommand\towner"

AdoptHeader is the checks file watch --adopt reads: one adoption check per line, the command held to the same argv rule as every other exec site.

View Source
const ChildCap = 64 * 1024
View Source
const HTTPCap = 256 * 1024
View Source
const Header = "name\tkind\tinstalled\tlatest\tapply\towner"

Variables

View Source
var Kinds = []string{"harness", "engine", "model", "tool", "pin"}

Functions

func Compare

func Compare(a, b string) string

Compare orders only equally long, plain numeric release tags. Arbitrary-size components avoid both floating-point loss and machine integer overflow.

func Main

func Main(name string, args []string, stamp string, out, errs io.Writer) int

func Run

func Run(name string, args []string, stamp string, out, errs io.Writer, env Environment) (rc int)

func VersionTool added in v1.2.3

func VersionTool(stamp string, env Environment) *tool.Tool

VersionTool is nova-version on pkg/tool: its verbs are this package's moved, snapshot and diff (SPEC-VERSION), and report and send, which share nova-update's report body. Run("nova-version", ...) is this tool's Run, so the package's tests reach it by that name.

func WithDrainTimer added in v1.2.3

func WithDrainTimer(ctx context.Context, fn func(time.Duration) (<-chan time.Time, func() bool)) context.Context

WithDrainTimer attaches a custom drain timer seam to the context.

Types

type AdoptCheck added in v1.2.3

type AdoptCheck struct {
	Name, Owner string
	Command     []string
}

AdoptCheck is one row of the checks file.

func LoadAdopt added in v1.2.3

func LoadAdopt(r io.Reader) ([]AdoptCheck, error)

LoadAdopt reads the checks file watch --adopt names. The first line must equal the header byte for byte and every other line is one tab-separated check; a `#` first character opens a comment.

type Entry

type Entry struct {
	Name, Kind, Latest, Owner string
	Installed, Apply          []string
}

func Load

func Load(r io.Reader) ([]Entry, error)

Load reads the manifest (SPEC-UPDATE rule 2) and returns every problem it finds as one *ManifestError: the header, then each line's fields in order, every bad field of a line named and every bad line of the file. A file with no problem yields its entries.

type Environment

type Environment struct {
	Process processFunc
	// Env is the environment a spawned child gets, and the PATH its name is
	// looked up on. Nil inherits this process's own.
	Env         []string
	Now         func() time.Time
	Client      *http.Client
	Context     context.Context
	WorkerStart func(id int)
	JobAttempt  func(index int)
	DrainTimer  func(time.Duration) (<-chan time.Time, func() bool)
	// Rename commits a snapshot; nil is os.Rename.
	Rename func(oldPath, newPath string) error
	// OpenStore dials the fleet store for report --store; nil is store.Open,
	// which authenticates from the process environment.
	OpenStore func(ctx context.Context, addr string) (*store.Store, error)
}

Environment supplies deterministic clock/network seams. Nil values use the machine clock and a credential-free, redirect-bounded HTTP client.

type ManifestError added in v1.2.3

type ManifestError struct {
	Problems []string
	// More is how many problems past manifestProblemCap were found and not listed.
	More int
}

ManifestError is every problem one read of a manifest found, in line order, each one worded as a single-problem refusal was (`line 3: ...`): a run that finds several says so once, and the writer fixes the file in one pass and not one error per run.

func (*ManifestError) Error added in v1.2.3

func (e *ManifestError) Error() string

type ProcessResult

type ProcessResult struct{ Stdout, Stderr, Path, Reason string }

type Read

type Read struct{ Raw, Version, Path, Reason, Remedy, Source string }

func (Read) Known

func (r Read) Known() bool

Jump to

Keyboard shortcuts

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