code wiki / _hdl_build / nx_wiki_restore.nx
nx_wiki_restore.nx
buildroot/runtime/_hdl_build/nx_wiki_restore.nx
about
nx_wiki_restore.nx -- A4a: FULL RESTORE to ANY retained rollback point.
THE OPERATOR PRECONDITION (verbatim intent): roll back "not just to another broken one but have FULL
RESTORE via MULTIPLE rollback points." restore(slug, v#) makes the LIVE page byte-exact the content of
version v# -- ANY v#, not just the last. The bytes come from the content-addressed archive by CID, so
what gets republished is GUARANTEED identical to what was captured (a CID names exactly one byte string).
COMPOSITION (no storage/crypto reinvented):
nx_wiki_versioned_publish vp_cid_of_version (resolve v# -> CID from the durable version index)
nx_wiki_archive war_get_by_cid (no-loss retrieval of the EXACT bytes by CID)
nx_wiki_publish pub_publish_ex (A3 GUARDED re-publish -- the restore goes live ONLY if
the A2 guard re-ALLOWs it; a restore is itself a guarded publish)
nx_seg_store (transitively, via the archive store)
ADDITIVE: a restore writes NOTHING destructive. It reads an immutable blob and re-publishes it; the
version index is unchanged (the restored content already has its own retained v#). It is also safe to
pair with vpub -- a caller that wants the restore itself recorded as a NEW head simply vpub's the
restored bytes afterward (the live-proof runner does exactly this is NOT required: restore re-pushes the
exact old bytes; re-capturing is optional and additive).
REFUSAL (liar-kill): an unknown v# returns VR_NOT_FOUND and the push path is NEVER reached -- a restore
cannot silently push garbage for a version that was never retained.
Pure NishiLang, NO sql/.sh/.py/.js, no new .tsv/.conf. license_tier: ORIGINAL
dependencies 4 imports · 3 importers
imports: nx_wiki_versioned_publish.nxnx_wiki_archive.nxnx_wiki_publish.nxnx_syscalls.nx
imported by: nx_wiki_versioned_publish_gate.nxnx_wiki_versioned_publish_live.nxnx_wiki_versioned_rollback_observe.nx
structs
| none |
consts
| 31 | const VR_OK: i64 = 0 |
| 32 | const VR_BAD_INPUT: i64 = 0 - 4950 // null/empty slug, or v# < 1 |
| 33 | const VR_NOT_FOUND: i64 = 0 - 4951 // requested version# has no retained record (REFUSED, no push) |
| 34 | const VR_BLOB_MISSING: i64 = 0 - 4952 // CID retained but its blob could not be resolved (store damage) |
| 35 | const VR_WRITE_FAILED: i64 = 0 - 4953 // could not stage the restored bytes to a local file |
| 36 | const VR_PUSH_REJECT: i64 = 0 - 4954 // A3 guard REJECTED the restored page (fail-closed) |
| 38 | const VR_SCAN_CAP: i64 = 256 // segment-scan cap for war_get_by_cid / version-index lookups |
| 39 | const VR_MODE_0644: i64 = 0x1a4 |
functions
| 41 | func vr_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: restore_ex |
| 44 | func vr_write_file(path: *u8, buf: *u8, n: i64) -> i64 |
| 67 | func restore_ex(prefix: *u8, slug: *u8, version: i64, stage_path: *u8, called by 2: restoremain calls 6: vr_lensys_mmapvp_cid_of_versionwar_get_by_cidvr_write_filepub_publish_ex |
| 99 | func restore(slug: *u8, version: i64, stage_path: *u8, |
| 107 | func vr_status_name(s: i64) -> *u8 |