nx_lib_store.nx
buildroot/runtime/nx_lib_store.nx
about
nx_lib_store.nx -- sovereign CATALOG STORE for the nishi-library, on the
sovereign nx_seg_store (append-only, additive, crash-safe rename-commit) with
the O(1) nx_hash_index get path. RETIRES the 3rd-party SQLite catalog.db
(operator 2026-06-30: "no 3rd-party db; s-class exceed everywhere").
key = "work:<work_hk>"
val = title<TAB>doi<TAB>published<TAB>license<TAB>abstract
"__works__" record = newline-separated work_hks, advanced IN THE SAME COMMIT
so enumeration is atomic (no torn state).
S-CLASS-EXCEED vs SQLite (parity + beyond):
parity : put / get / enumerate / update by key.
beyond : O(1) hash get (65 ns = 3.8x SQLite's B-tree probe, nx_hash_index_bench);
APPEND-ONLY history -- no UPDATE/DELETE destruction ("history is sacred");
crash-safe rename-commit; ZERO 3rd-party; durable + sovereign on disk.
license_tier: ORIGINAL | genealogy_id: nishi_library_sovereign_db_2026_06_30
dependencies 2 imports · 9 importers
imports: nx_syscalls.nxnx_seg_store.nx
imported by: nx_lib_compact.nxnx_lib_index.nxnx_lib_ingest_json.nxnx_lib_ingest_tsv.nxnx_lib_openalex.nxnx_lib_page.nxnx_lib_search.nxnx_lib_serve.nxnx_lib_store_test.nx
structs
| none |
consts
| 19 | const LIB_MAGIC_1048576: i64 = 1048576 |
| 21 | const LIB_PREFIX: *u8 = "knowledge/libstore-" as *u8 |
functions
| 23 | func ls_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 24 | func ls_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ dst[off+i]=s[i]; i=i+1 } return off+i } called by 1: ls_key |
| 27 | func ls_key(kbuf: *u8, hk: *u8) -> i64 called by 4: nx_lib_store_put_worknx_lib_store_bulk_addnx_lib_store_get_worknx_lib_store_get_work_h calls 1: ls_cat |
| 35 | func ls_name_present(buf: *u8, n: i64, name: *u8, namelen: i64) -> i64 |
| 56 | func nx_lib_store_put_work(hk: *u8, record: *u8, reclen: i64) -> i64 |
| 87 | func nx_lib_store_bulk_begin(worksbuf: *u8, worklen_p: *i64) -> *i64 |
| 102 | func nx_lib_store_bulk_add(w: *i64, kbuf: *u8, worksbuf: *u8, worklen_p: *i64, hk: *u8, record: *u8, reclen: i64) -> *i64 called by 2: nx_lib_gbif_ingest_bufnx_lib_openalex_ingest_buf calls 7: ls_keyss_addss_next_segidss_commitss_beginls_strlen+1 |
| 127 | func nx_lib_store_bulk_commit(w: *i64, worksbuf: *u8, worklen: i64) -> i64 called by 2: nx_lib_gbif_ingest_bufnx_lib_openalex_ingest_buf calls 4: ss_next_segidss_commitss_beginss_add |
| 137 | func nx_lib_store_get_work(hk: *u8, ptrout: *i64, lenout: *i64) -> i64 called by 5: mainlhd_page_worknx_lib_search_querynx_lib_serve_workmain calls 3: sys_mmapls_keyss_get |
| 147 | func nx_lib_store_open() -> *i64 |
| 150 | func nx_lib_store_get_work_h(h: *i64, kbuf: *u8, hk: *u8, ptrout: *i64, lenout: *i64) -> i64 |
| 156 | func nx_lib_store_index(idxbuf: *u8) -> i64 |
| 167 | func nx_lib_store_count() -> i64 |