nx_libdata.nx
buildroot/runtime/nx_libdata.nx
about
nx_libdata.nx -- THE SELF-SUFFICIENCY DATA LIBRARY ENGINE (ws=library-datasets, 2026-07-31).
Operator goal: collect the datasets that were NOT coming in, ranked MOST VALUABLE to LEAST for
household self-sufficiency against the cost-of-living crisis (gardening, NSF, manufacturing, ...).
WHY: the library answered 'gardening' with garden-centre shop pages, and knowledge/fetched/ held
44 Wikipedia pages. Root cause (debt 1785516741/1785516905) was TRANSPORT, not a missing list:
every ingester called the TLS-1.3-only fetch entry point, so TLS-1.2-only hosts -- exactly where
US federal open data lives -- were unreachable. This organ deliberately calls the WIDE-REACH
nx_https_fetch_follow_best so it can never regress to the narrow path.
DATA-DRIVEN BY CONSTRUCTION (rule 11): the source list is knowledge/registry/selfsuff_datasets.tsv
and the ranking weights are knowledge/status/selfsuff_axes.conf. Adding a dataset is ONE ROW and
zero code; re-prioritising the whole library is editing four weights. Contrast nx_supply_research_fetch,
which hardcodes 44 URLs in its body.
verbs: rank | gaps | fetch [maxn] | status | selftest
expect_exit: 0 license_tier: ORIGINAL
dependencies 9 imports · 0 importers
imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nxnx_sha256.nxnx_store_seed_lib.nxnx_lib_openalex.nxnx_lib_search.nxnx_gzip_wrap.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
| 27 | const LD_MAGIC_2048: i64 = 2048 |
| 28 | const LD_MAGIC_65558: i64 = 65558 |
| 29 | const LD_MAGIC_4096: i64 = 4096 |
| 31 | const LD_BUF: i64 = 262144 |
| 32 | const LD_AXBUF: i64 = 16384 |
| 33 | const LD_ROWS: i64 = 256 |
| 38 | const LD_NF: i64 = 15 |
| 39 | const LD_FETCH: i64 = 134217728 |
| 40 | const LD_PATH: i64 = 1024 |
| 41 | const LD_CERT: i64 = 4194304 |
| 42 | const LD_MODE_644: i64 = 420 |
| 43 | const LD_PERMIL: i64 = 1000 |
| 44 | const LD_TAB: i64 = 9 |
| 45 | const LD_NL: i64 = 10 |
| 46 | const LD_HASH: i64 = 35 |
| 47 | const LD_ACCESS_FULL: i64 = 10 |
| 48 | const LD_HOPS: i64 = 6 |
| 50 | const LD_CHUNK: i64 = 131072 |
| 51 | const LD_MAXCHUNKS: i64 = 1100 |
| 52 | const LD_WINDOW_TRIES: i64 = 4 |
| 54 | const LD_BACKOFF_MS: i64 = 1500 |
| 55 | const LD_REFETCH_MS: i64 = 8000 |
| 58 | const F_ID: i64 = 0 |
| 59 | const F_DOMAIN: i64 = 1 |
| 60 | const F_URL: i64 = 3 |
| 61 | const F_SAVE: i64 = 6 |
| 62 | const F_BREADTH: i64 = 7 |
| 63 | const F_DUR: i64 = 8 |
| 64 | const F_UNSUB: i64 = 9 |
| 65 | const F_ACCESS: i64 = 10 |
| 66 | const F_STATUS: i64 = 11 |
| 67 | const F_MINBYTES: i64 = 13 |
| 68 | const F_MAXAGE: i64 = 14 |
| 69 | const LD_SECS_DAY: i64 = 86400 |
| 72 | const LD_SCANHEAD: i64 = 2048 |
| 73 | const LD_CATALOG: *u8 = "knowledge/store/libdata-" as *u8 |
| 74 | const LD_REJCONF: *u8 = "knowledge/status/selfsuff_reject.conf" as *u8 |
| 75 | const LD_PROV: *u8 = "knowledge/status/selfsuff_provenance.tsv" as *u8 |
functions
| 80 | func ld_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 81 | func ld_emit(s: *u8) -> i64 { let n: i64 = ld_vlen(s); sys_write(1, s, n); return 0 } |
| 82 | func ld_lit_eq(s: *u8, off: i64, len: i64, lit: *u8) -> i64 |
| 90 | func ld_puts(s: *u8) -> i64 { ld_emit(s); return 0 } |
| 95 | func ld_putn(v: i64) -> i64 |
| 107 | func ld_write_n(s: *u8, n: i64) -> i64 { sys_write(1, s, n); return 0 } |
| 109 | func ld_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 119 | func ld_have(path: *u8) -> i64 |
| 127 | func ld_atoi(buf: *u8, o: i64, len: i64) -> i64 |
| 142 | func ld_eol(buf: *u8, from: i64, n: i64) -> i64 |
| 155 | func ld_conf_int(buf: *u8, n: i64, key: *u8, dflt: i64) -> i64 |
| 181 | func ld_parse(buf: *u8, n: i64, fo: *i64, fl: *i64) -> i64 |
| 221 | func ld_field_i(buf: *u8, fo: *i64, fl: *i64, r: i64, f: i64) -> i64 |
| 227 | func ld_score(buf: *u8, fo: *i64, fl: *i64, r: i64, ws: i64, wb: i64, wu: i64, wd: i64) -> i64 |
| 238 | func ld_order(sc: *i64, ord: *i64, rows: i64) -> i64 called by 1: ld_load |
| 258 | func ld_outpath(dst: *u8, buf: *u8, fo: *i64, fl: *i64, r: i64) -> i64 |
| 276 | func ld_cstr(dst: *u8, buf: *u8, o: i64, len: i64) -> i64 called by 1: main |
| 283 | func ld_load(rpath: *u8, apath: *u8, buf: *u8, ax: *u8, fo: *i64, fl: *i64, sc: *i64, ord: *i64, wout: *i64) -> i64 |
| 308 | func ld_find_last(b: *u8, n: i64, lit: *u8, litlen: i64, window: i64) -> i64 |
| 325 | func ld_zip_eocd(b: *u8, n: i64) -> i64 |
| 338 | func ld_json_closed(b: *u8, n: i64, want: i64) -> i64 |
| 363 | func ld_buf_complete(vbuf: *u8, n: i64) -> i64 |
| 374 | func ld_file_complete(path: *u8, vbuf: *u8) -> i64 |
| 383 | func ld_hexdig(v: i64) -> i64 called by 1: ld_sha_hex |
| 389 | func ld_sha_hex(b: *u8, n: i64, outhex: *u8) -> i64 |
| 403 | func ld_app_str(d: *u8, o: i64, s2: *u8) -> i64 |
| 408 | func ld_app_n(d: *u8, o: i64, v: i64) -> i64 |
| 424 | func ld_prov_append(idb: *u8, idlen: i64, url: *u8, status: i64, bytes: i64, hex: *u8, verdict: *u8) -> i64 called by 1: main calls 7: sys_mmapld_app_nsys_now_realtime_secld_app_strsys_openat_appendsys_write+1 |
| 451 | func ld_prov_last(idb: *u8, idlen: i64, pbuf: *u8) -> i64 |
| 478 | func ld_has_marker(b: *u8, n: i64, conf: *u8, cn: i64) -> i64 |
| 505 | func ld_find_past(b: *u8, n: i64, needle: *u8) -> i64 |
| 522 | func ld_copy_until_quote(b: *u8, n: i64, from: i64, out: *u8) -> i64 called by 1: ld_next_cursor |
| 534 | func ld_next_cursor(b: *u8, n: i64, out: *u8) -> i64 |
| 543 | func ld_row_line(buf: *u8, fo: *i64, fl: *i64, r: i64, score: i64, rank: i64, have: i64) -> i64 |
| 559 | func main(argc: i64, argv: *i64) -> i64 |