Expand description
Erlang/OTP-style appup — declarative upgrade instructions per
prior caixa version. Composes with the :behavior :on-state-change
callback to deliver state migration during hot upgrades.
See theory/INSPIRATIONS.md §II.4 for the prior-art frame.
(defcaixa
:nome "hello-rio"
:versao "0.2.0"
:upgrade-from
((:from "0.1.0"
:instructions ((:load-module "hello-rio")
(:state-change "lib/migrations/v01-to-v02.lisp")
(:soft-purge "hello-rio-old")))
(:from "0.1.5"
:instructions ((:load-module "hello-rio")
(:soft-purge "hello-rio-old")))))Each (:from <prior>) block declares the upgrade path from that
version to the current :versao. wasm-operator picks the
matching block at upgrade time, runs the instructions in order,
and only swaps traffic to the new instance after all instructions
succeed (transactional upgrade). On any failure, the current
version stays load-bearing — a typed atomic upgrade.
Structs§
- Upgrade
From Entry - One upgrade entry: the prior version we’re upgrading from, plus the instruction sequence to execute.
Enums§
- Upgrade
Error - Upgrade
Instruction - One upgrade instruction. The set mirrors OTP’s appup low-level instructions: enough to express every common upgrade pattern, few enough that the wasm-operator can implement each deterministically.
Functions§
- validate_
upgrade_ from - Validate a whole
:upgrade-fromlist: per-entry typed shape viaUpgradeFromEntry::validateand the cross-entry graph-edge-set invariant — at most one(:from <prior>)block per parsed semver. - validate_
upgrade_ from_ against_ behavior - Reject
:upgrade-fromentries whose:instructionslist carries any(:state-change <script>)instruction unless the caixa also declares:behavior :on-state-change— the runtime callback the per-version migration script is delivered through during hot upgrade. - validate_
upgrade_ from_ against_ versao - Reject
:upgrade-fromentries whose:fromis not strictly less than the caixa’s current:versao(under SemVer-2 precedence — the same orderingsemver::Version::cmpimplements, with build metadata ignored per SemVer §11).