code wiki / _hdl_build / nx_wiki_versioned_publish.nx

nx_wiki_versioned_publish.nx

buildroot/runtime/_hdl_build/nx_wiki_versioned_publish.nx

13048 B268 linesdepth 9pulls 10 transitivereach 19 importersview sourcekind librarytopic wiki
docsdependenciesstructsconstsfunctions

about

nx_wiki_versioned_publish.nx -- A4a: VERSIONED-PUBLISH + the multi-point rollback INDEX. THE OPERATOR PRECONDITION (verbatim intent): "ability to revert via versions held so we can roll back not just to another broken one but have FULL RESTORE via MULTIPLE rollback points." This is the safety net that must exist BEFORE any full-auto re-publishing: every time a page goes live we FIRST capture the exact bytes as a RETAINED, content-addressed version record, so a later restore can land the LIVE page byte-exact on ANY prior version -- not just the last one, not just a different broken one. COMPOSITION (no storage/crypto reinvented -- every line below routes through a proven organ): nx_wiki_archive war_archive_page / war_get_by_cid / war_cid_of_body (content-addressed blob = the no-rot anchor; the SAME WAR_PREFIX store A2's guard resolves citations from, so a version blob survives across runs / is durable by construction). nx_seg_store ss_begin / ss_add / ss_commit / ss_get_cap (append-only durable KV: a new record is a NEW segment, never an in-place overwrite -- the additive-data law #13). nx_canon_cid cid_of (via war_cid_of_body) (CID = nxc1-+sha256(bytes)). nx_wiki_publish pub_publish_ex (A3 GUARDED publish -- the SOLE enforcement point; EVERY live write here flows through the A2 guard, fail-closed). THE VERSION INDEX (a SEPARATE key family in the SAME durable store; never collides with wikiblob:/wikicid: which the archive owns): wpv:cnt:<slug> -> decimal version COUNT for the slug (a latest-wins pointer; seg_store keeps every prior value in history too, so even this is additive, never destroyed) wpv:ver:<slug>:<v#> -> the content CID of version v# (written EXACTLY ONCE per (slug,v#); a new publish appends a NEW v#, it NEVER rewrites an existing wpv:ver key -- this is the append-only, multi-rollback-point guarantee, mechanical not promised) wpv:ep:<slug>:<v#> -> the fixed epoch stamped for v# (written once; NO wall-clock call -- the caller passes a fixed epoch so the record is deterministic/reproducible) Because v# is monotonic and each wpv:ver:<slug>:<v#> key is unique, publishing v2/v3 can NEVER mutate or delete the v1 record. The blob itself is content-addressed, so even dropping a pointer cannot lose bytes. Pure NishiLang, NO sql/.sh/.py/.js, no new .tsv/.conf. license_tier: ORIGINAL

dependencies 4 imports · 16 importers

nx_wiki_publish.nx nx_wiki_archive.nx nx_seg_store.nx nx_syscalls.nx nx_wiki_versioned_publish.nx nx_asset_dashboard_publish.nx nx_figures_publish.nx nx_ims_batch1_publish.nx nx_ims_batch1_repush.nx nx_ims_batch2_publish.nx nx_ims_batch2_repush.nx nx_ims_batch2_tail.nx nx_ims_search_publish.nx nx_math_render_publish.nx nx_wiki_pub_board.nx

diagram shows first 10 each side; +0 more imports, +6 more importers in the complete lists below.

imports: nx_wiki_publish.nxnx_wiki_archive.nxnx_seg_store.nxnx_syscalls.nx

imported by: nx_asset_dashboard_publish.nxnx_figures_publish.nxnx_ims_batch1_publish.nxnx_ims_batch1_repush.nxnx_ims_batch2_publish.nxnx_ims_batch2_repush.nxnx_ims_batch2_tail.nxnx_ims_search_publish.nxnx_math_render_publish.nxnx_wiki_pub_board.nxnx_wiki_restore.nxnx_wiki_structure_regen.nxnx_wiki_versioned_publish_gate.nxnx_wiki_versioned_publish_live.nxnx_wiki_vplist_probe.nxnx_wiki_walk_republish.nx

structs

none

consts

38const VP_OK: i64 = 0
39const VP_BAD_INPUT: i64 = 0 - 4940 // null/empty slug or path
40const VP_READ_FAILED: i64 = 0 - 4941 // could not read the new local page bytes
41const VP_ARCHIVE_FAIL: i64 = 0 - 4942 // archive add/commit returned an error
42const VP_NOT_FOUND: i64 = 0 - 4943 // requested version# has no retained record
43const VP_PUSH_REJECT: i64 = 0 - 4944 // A3 guard REJECTED the page (fail-closed; nothing pushed)
46const VP_SCAN_CAP: i64 = 256
48const VP_MAX_VERS: i64 = 4096
50const VP_MODE_0644: i64 = 0x1a4

functions

53func vp_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: vpub_ex
56func vp_cat(dst: *u8, off: i64, s: *u8) -> i64
63func vp_catn(dst: *u8, off: i64, v: i64) -> i64
called by 3: vp_ver_keyvp_ep_keyvpub_ex calls 1: sys_mmap
74func vp_parse_dec(b: *u8, n: i64) -> i64
called by 1: vp_get_count
89func vp_cnt_key(slug: *u8, out: *u8) -> i64
called by 2: vp_get_countvpub_ex calls 1: vp_cat
97func vp_ver_key(slug: *u8, v: i64, out: *u8) -> i64
107func vp_ep_key(slug: *u8, v: i64, out: *u8) -> i64
called by 1: vpub_ex calls 2: vp_catvp_catn
119func vp_get_count(prefix: *u8, slug: *u8) -> i64
139func vp_cid_of_version(prefix: *u8, slug: *u8, v: i64, cidout: *u8) -> i64
158func vp_list_ex(prefix: *u8, slug: *u8, vers: *i64, cidbuf: *u8, max: i64) -> i64
177func vp_list(slug: *u8, vers: *i64, cidbuf: *u8, max: i64) -> i64
called by 2: mainmain calls 1: vp_list_ex
197func vpub_ex(prefix: *u8, slug: *u8, new_local_html_path: *u8,
251func vpub(slug: *u8, new_local_html_path: *u8,
260func vp_status_name(s: i64) -> *u8