Documentation
¶
Overview ¶
Package reinstall implements the daemon's reinstall-handoff checkpoint.
Lifecycle:
- PrepareReinstall RPC writes a JSON checkpoint listing every running go-exec target (target ID, mode, env). Containers aren't listed — they survive the daemon's death anyway.
- Daemon exits cleanly; go-exec children receive SIGTERM via the normal Kill path.
- Install script overwrites the binary.
- New daemon starts, observes the checkpoint at well-known path, re-launches the listed go-exec targets, deletes the checkpoint.
The checkpoint is single-purpose handoff state — the daemon's correctness doesn't depend on it (missing checkpoint = degraded behavior, not broken behavior). This preserves the daemon's stateless-recovery principle.
Index ¶
Constants ¶
const SchemaVersion = 1
SchemaVersion is bumped when Checkpoint's shape changes. An older daemon reading a newer schema (or vice versa) silently discards the checkpoint — handoff degrades gracefully rather than fails.
Variables ¶
This section is empty.
Functions ¶
func EnsureSinglePending ¶
func EnsureSinglePending() error
EnsureSinglePending guards against double-checkpoint races. If the checkpoint already exists when a new PrepareReinstall arrives, returns an error rather than overwriting (the caller is responsible for resolving — typically by aborting the second install).
func Exists ¶
func Exists() bool
Exists reports whether the checkpoint file is present. Cheap — used by Status to surface "reinstall pending".
func Write ¶
func Write(cp Checkpoint) error
Write serializes cp to Path(), fsync'd. Atomic via tmp+rename so a crash between write and rename doesn't leave a corrupt file. Stamps the schema + timestamp itself.
Types ¶
type Checkpoint ¶
type Checkpoint struct {
Schema int `json:"schema"`
WrittenAt time.Time `json:"written_at"`
GoExec []GoExecCheckpoint `json:"go_exec"`
}
Checkpoint is the JSON document persisted between daemon invocations.
func Read ¶
func Read() (*Checkpoint, error)
Read returns the checkpoint at Path(), or (nil, nil) if no checkpoint exists (the common case at every fresh start). A schema mismatch or malformed file is returned as (nil, nil) — handoff degrades to "containers survive, go-exec targets are lost" rather than failing the daemon's startup.
type GoExecCheckpoint ¶
GoExecCheckpoint is one running go-exec target's relaunch payload. Container targets are NOT recorded — podman keeps them alive across daemon restarts, and adoption (a separate phase 3 follow-up) picks them up.