code wiki / _hdl_build / nx_wiki_restore.nx

nx_wiki_restore.nx

buildroot/runtime/_hdl_build/nx_wiki_restore.nx

6343 B115 linesdepth 10pulls 11 transitivereach 3 importersview sourcekind librarytopic wiki
docsdependenciesstructsconstsfunctions

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

nx_wiki_versioned_publish.nx nx_wiki_archive.nx nx_wiki_publish.nx nx_syscalls.nx nx_wiki_restore.nx nx_wiki_versioned_publish_gate.nx nx_wiki_versioned_publish_live.nx nx_wiki_versioned_rollback_observe

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

31const VR_OK: i64 = 0
32const VR_BAD_INPUT: i64 = 0 - 4950 // null/empty slug, or v# < 1
33const VR_NOT_FOUND: i64 = 0 - 4951 // requested version# has no retained record (REFUSED, no push)
34const VR_BLOB_MISSING: i64 = 0 - 4952 // CID retained but its blob could not be resolved (store damage)
35const VR_WRITE_FAILED: i64 = 0 - 4953 // could not stage the restored bytes to a local file
36const VR_PUSH_REJECT: i64 = 0 - 4954 // A3 guard REJECTED the restored page (fail-closed)
38const VR_SCAN_CAP: i64 = 256 // segment-scan cap for war_get_by_cid / version-index lookups
39const VR_MODE_0644: i64 = 0x1a4

functions

41func 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
44func vr_write_file(path: *u8, buf: *u8, n: i64) -> i64
67func restore_ex(prefix: *u8, slug: *u8, version: i64, stage_path: *u8,
99func restore(slug: *u8, version: i64, stage_path: *u8,
called by 2: mainmain calls 1: restore_ex
107func vr_status_name(s: i64) -> *u8
called by 3: mainmainmain