code wiki / (root) / nx_index_migrate_gate.nx

nx_index_migrate_gate.nx

buildroot/runtime/nx_index_migrate_gate.nx

8188 B125 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic index
docsdependenciesstructsconstsfunctions

about

nx_index_migrate_gate.nx -- THE MIGRATION-PROOF gate (operator headline: "migratable to bigger + more sophisticated hardware"). Proves the sovereign inverted index is a PORTABLE BYTE ARTIFACT: build on "hw-A", save, COPY the file to a different path (= migrate to a different host/disk/hardware), LOAD from the copy, re-query -> BYTE-IDENTICAL. Plus pin the format endian/word-size (i64 LE MAGIC round-trips) so it ports to different/more-sophisticated ISAs incl. our own sovereign silicon. WHY it works: vocab slots store OFFSETS not pointers -> load needs ZERO relocation; no JVM/OS lock-in. Format is byte-compatible with nx_search_inverted_persist (NXINV magic); serializer inlined here to keep a single clean syscalls lineage (the _hdl_build persist cross-import trips the compiler on this graph -- a known large-graph double-import limitation, filed). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_search_inverted.nx nx_index_migrate_gate.nx

imports: nx_search_inverted.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gw sys_mkdir nx_inv_new nx_inv_index_row nx_inv_is_token_char nx_inv_hash_bytes_lower nx_inv_add_posting nx_inv_count_token nx_inv_slot_at nx_inv_slot_hash nx_inv_slot_set_hash nx_inv_slot_set_postings_c nx_inv_slot_postings_count mig_slen nx_inv_finalize_offsets nx_inv_slot_at ↻ nx_inv_slot_hash ↻ nx_inv_slot_postings_count ↻ nx_inv_slot_set_postings_o nx_inv_slot_set_write_curs nx_inv_emit_row nx_inv_is_token_char ↻ nx_inv_hash_bytes_lower ↻ nx_inv_emit_posting nx_inv_slot_at ↻ nx_inv_slot_hash ↻ nx_inv_slot_postings_count ↻ nx_inv_slot_postings_offse nx_inv_slot_write_cursor nx_inv_slot_set_write_curs ↻ mig_query nx_inv_hash_bytes_lower ↻ mig_slen ↻ nx_inv_lookup_slot nx_inv_slot_at ↻ nx_inv_slot_hash ↻ nx_inv_slot_postings_count ↻ nx_inv_slot_postings_offse ↻ gn

structs

none

consts

11const MIG_MAGIC: i64 = 336659591510 // "NXINV" -- byte-identical to nx_search_inverted_persist

functions

13func gw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main
14func gn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(28); var k: i64=0; while m>0 { t[k]=48+(m%10); m=m/10; k=k+1 } while k>0 { k=k-1; sys_write(1,(((t as i64)+k) as *u8),1) } return 0 }
called by 1: main
15func mig_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: mig_querymain
16func mig_wall(fd: i64, buf: *u8, n: i64) -> i64 { var off: i64=0; while off<n { let w: i64=sys_write(fd, ((buf as i64)+off) as *u8, n-off); if w<=0 { return 0-1 } off=off+w } return off }
called by 2: mig_savemig_copy
19func mig_save(idx: *NxInvIndex, path: *u8) -> i64
called by 1: main calls 2: sys_openat_wrmig_wall
29func mig_load(path: *u8) -> *NxInvIndex
called by 1: main calls 1: sys_read_file
44func mig_copy(src: *u8, dst: *u8) -> i64
53func mig_query(idx: *NxInvIndex, term: *u8, out_ids: *i64) -> i64
67func mig_ids_eq(a: *i64, an: i64, b: *i64, bn: i64) -> i64 { if an!=bn { return 0 } var i: i64=0; while i<an { if a[i]!=b[i] { return 0 } i=i+1 } return 1 }
called by 1: main
69func main() -> i64