nx_wiki_archive.nx
buildroot/runtime/wiki/nx_wiki_archive.nx
about
nx_wiki_archive.nx -- NO-LINK-ROT for the sovereign wiki.
THE LAW (operator, standing): "No link rot. Archive all information into the
Nishi Library so nothing that helped us get here is lost; links should always
work." This organ makes rot STRUCTURALLY IMPOSSIBLE via content-addressing.
MECHANISM (why rot cannot happen here):
Each page's raw bytes are stored under a KEY that IS the hash of those
bytes -- the CID = "nxc1-" + 64 hex of sha256(body), from nx_canon_cid's
cid_of() (substrate-canonical, FIPS 180-4 KAT'd via nx_sha256). A CID can
ONLY ever name one byte string: hand back a CID, you get back the EXACT
bytes that produced it, forever. So:
- identical content collapses to ONE blob (same bytes -> same CID -> dedup)
- a CID link NEVER rots: the key is derived from the content, so as long
as the immutable append-only seg_store keeps the blob, the link resolves
- this is HOW we exceed Wikipedia, which leans on the Internet Archive to
paper over rot after the fact; here rot is a non-event by construction.
STORE: the content-addressed append-only seg_store (runtime/nx_seg_store.nx),
prefix "knowledge/store/wikiarchive-" (the library's own durability
substrate). No nx_library_*.nx ingest organ exists yet, so we land in the
seg_store directly; full library-corpus / BM25 unification = a flagged
follow-on, NOT silently done here.
LAYOUT (two key families in one store):
wikiblob:<cid> -> the page bytes (content-addressed; idempotent dedup)
wikicid:<slug> -> the page's CURRENT cid (slug -> content pointer; mutable
by ADDITIVE re-archive, old versions stay in history)
Dropping a wikicid:<slug> pointer never loses data -- the blob is still keyed
by its CID (the no-loss proof).
IMPORTS: nx_seg_store + nx_canon_cid. Both transitively pull nx_syscalls; the
NishiLang resolver de-dups by module identity (nx_infomgmt_gate.nx imports the
same trio and builds), so no double-import nxasm-rc6 landmine.
Pure NishiLang, NO SQL, NO .sh/.py/.js, no new .tsv/.conf. license_tier: ORIGINAL
dependencies 2 imports · 7 importers
imports: nx_seg_store.nxnx_canon_cid.nx
imported by: _wiki_archive_gate.nx_wiki_search_gate.nxnx_wiki_bm25_search.nxnx_wiki_license.nxnx_wiki_publish_guard.nxnx_wiki_restore.nxnx_wiki_versioned_publish.nx
structs
| none |
consts
| 39 | const WAR_PREFIX: *u8 = "knowledge/store/wikiarchive-" |
functions
| 42 | func war_len(s: *u8) -> i64 |
| 49 | func war_cat(dst: *u8, off: i64, s: *u8) -> i64 |
| 56 | func war_blobkey(cid: *u8, out: *u8) -> i64 |
| 65 | func war_cidkey(slug: *u8, out: *u8) -> i64 |
| 78 | func war_cid_of_body(body: *u8, body_n: i64, cidout: *u8) -> i64 |
| 89 | func war_archive_page(w: *i64, slug: *u8, body: *u8, body_n: i64, cidout: *u8) -> i64 |
| 110 | func war_get_by_cid(prefix: *u8, cid: *u8, ptrout: *i64, cap: i64) -> i64 called by 10: mainmainmainnx_wbs_gather_archivenx_wiki_cite_onemain+4 calls 2: war_blobkeyss_get_cap |
| 123 | func war_cid_of_slug(prefix: *u8, slug: *u8, cidout: *u8, cap: i64) -> i64 |
| 143 | func war_slug_exists(prefix: *u8, slug: *u8, slug_n: i64, cap: i64) -> i64 |
| 166 | func nx_wiki_rot_audit_page(prefix: *u8, body: *u8, body_n: i64, cap: i64, |