code wiki / _hdl_build / nx_lib_uxf_ingest.nx
nx_lib_uxf_ingest.nx
buildroot/runtime/_hdl_build/nx_lib_uxf_ingest.nx
about
nx_lib_uxf_ingest.nx -- Library arc R4a: content-address the CALIBRE CATALOG into the UXF envelope
("everything in our superior format"). Reads the book index (idx_book.wsl), and for each book builds a
canonical UXF DOC record {bk=path, ti=basename, fmt=ext} -> uxf_cid_profiled(UXF_DOC) -> append to a
content-addressed seg_store (batched across segments because ss_begin's writer is 1 MiB). Then a gate
proves it: count, retrieve-by-CID byte-faithful, no-fabrication (absent CID -> not found), tamper-evident
(one flipped byte -> different CID), distinct books -> distinct CIDs.
This makes each book a tamper-evident, dedupable, retrievable UXF record (the LIB02/LIB04 moat applied to
the real 5761-book catalog). HONEST: metadata records here; per-book CONTENT conversion (epub/pdf text ->
UXF doc) is R4b. Reuses nx_canon_cid + nx_uxf_cid + nx_seg_store. No hardware writes (Rule 26).
license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_canon_cid.nxnx_uxf_cid.nxnx_seg_store.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 16 | const IU_MAGIC_2097152: i64 = 2097152 |
| 17 | const IU_MAGIC_8192: i64 = 8192 |
| 18 | const IU_MAGIC_8000: i64 = 8000 |
| 20 | const IU_IDX: *u8 = "knowledge/staging/media/idx_book.wsl" |
| 21 | const IU_PREFIX: *u8 = "knowledge/staging/media/uxf_lib/" |
functions
| 23 | func iu_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 24 | func iu_n(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 26 | func iu_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 36 | func iu_last(s: *u8, len: i64, b: i64) -> i64 { var i: i64=0; var r: i64=0-1; while i<len { if s[i]==(b as u8) { r=i } i=i+1 } return r } called by 1: iu_record |
| 38 | func iu_eq(a: *u8, an: i64, bp: *u8, bn: i64) -> i64 { if an!=bn { return 0 } var i: i64=0; while i<an { if a[i]!=bp[i] { return 0 } i=i+1 } return 1 } called by 1: main |
| 42 | func iu_record(path: *u8, plen: i64, canon: *u8, cid: *u8) -> i64 |
| 59 | func main() -> i64 |