archie-state-store gains the offline recovery commands
docs/prds/runtime-control-plane.md ("Bootstrap, migration, and recovery")
asks for. They work on the task database file directly -- <db_path>-tasks.sqlite,
not db_path -- and need neither archied nor the Web UI, which matters because
the failure they exist for is the one that stops archied starting:
backup -db F -out F consistent snapshot (VACUUM INTO), verified as a
usable store before it is published; safe against
a serving store
restore -db F -from F replace the database with a snapshot, dropping the
replaced file's -wal/-shm
validate -db F readable, not corrupt, schema no newer than this
binary, every stored resource decoding under the
definition that owns it
rollback -db F -kind K replay an earlier revision of a stored resource
[-revision N] through the ordinary replace, recorded as a new
revision
No rollback RPC is added and none is needed: a revision carries its own value,
so restoring one is the same replace the dashboard and the channels already
use, by hand, with the store stopped.
"The State Store is stopped" is checked rather than assumed. The serving
process now takes an exclusive flock on <db>.lock for its whole life
(store.AcquireOwnership), and restore/rollback refuse with
`task database is owned by another process` while it holds it. backup is the
deliberate exception: the update installer runs inside the process it is
replacing and cannot stop the State Store.
scripts/archie-update-install takes its pre-flight snapshot through
`go run ./cmd/archie-state-store backup` from the release being installed
instead of its own sqlite3 shell, so the installer and an operator run one
implementation. The watchdog's refusal semantics are unchanged: an update that
cannot back up still must not start.
Docs: safe-change-and-recovery.md's "Recovery: not yet built" now describes
what exists.
24 lines
817 B
Go
24 lines
817 B
Go
//go:build windows
|
|
|
|
// flock is a POSIX primitive and Windows is not a supported deployment surface
|
|
// (CLAUDE.md's deployment model is Linux and macOS), so this file fails closed:
|
|
// every lock attempt reports an error rather than silently degrading to "no
|
|
// lock". An offline command that cannot prove it owns the database must refuse
|
|
// to rewrite it, which is the only safe reading of an unavailable primitive.
|
|
//
|
|
// If a Windows deployment ever becomes supported, swap this for a real
|
|
// LockFileEx/UnlockFileEx pair; nothing else in the package needs to change.
|
|
|
|
package store
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
)
|
|
|
|
func lockFile(*os.File) (bool, error) {
|
|
return false, errors.New("store ownership locking requires a POSIX flock, which this platform does not provide")
|
|
}
|
|
|
|
func unlockFile(*os.File) error { return nil }
|