code wiki / (root) / nx_galx_index.nx

nx_galx_index.nx

buildroot/runtime/nx_galx_index.nx

6230 B148 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic galx
docsdependenciesstructsconstsfunctions

about

nx_galx_index.nx -- SOVEREIGN gallery index builder (replaces the bash build_view_index.sh; all logic is NishiLang per the ecosystem law). Reads the CID->path sidecar, derives each image's capture timestamp from its filename (YYYYMMDD_HHMMSS), sorts NEWEST-FIRST (iterative heapsort -- no recursion depth risk at 230k), de-dups by CID, and writes knowledge/status/galx_view_index.txt (one 69-char CID per line) that the daemon's /api/list + grid read. NO image is skipped: a row whose filename has no parseable timestamp still gets indexed with key 0 (sorts to the end), so every ingested image is browsable. Usage: nx_galx_index (no args). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_galx_index.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close gi_p sys_write sys_exit gi_ts gi_isdig gi_n nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap gi_heapsort gi_sift sys_openat_wr gi_cideq sys_write ↻ sys_close ↻

structs

none

consts

10const GI_MAGIC_1000000: i64 = 1000000
12const GI_CAP: i64 = 300000 // max images indexed (corpus is ~230k)
13const GI_SIDE: *u8 = "knowledge/status/galx_cid_paths.tsv" as *u8
14const GI_OUT: *u8 = "knowledge/status/galx_view_index.txt" as *u8

functions

16func gi_p(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 calls 1: sys_write
21func gi_n(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
23func gi_isdig(c: i64) -> i64 { if c < 48 { return 0 } if c > 57 { return 0 } return 1 }
called by 1: gi_ts
27func gi_ts(buf: *u8, off: i64, end: i64) -> i64
called by 1: main calls 1: gi_isdig
53func gi_sift(idx: *i64, key: *i64, root0: i64, n: i64) -> i64
called by 1: gi_heapsort
71func gi_heapsort(idx: *i64, key: *i64, n: i64) -> i64
called by 1: main calls 1: gi_sift
84func gi_cideq(buf: *u8, a: i64, b: i64) -> i64
called by 1: main
90func main() -> i64