code wiki / (root) / nx_index_wr_decouple.nx

nx_index_wr_decouple.nx

buildroot/runtime/nx_index_wr_decouple.nx

1494 B15 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic index
docsdependenciesstructsconstsfunctions

about

nx_index_wr_decouple.nx -- LIB: WRITE-READ DECOUPLING (LSM/Lucene near-real-time model). The ingest (WRITE) path builds NEW immutable segments and advances a GENERATION; the query (READ) path serves a pinned generation SNAPSHOT. Because segments are append-only + immutable (nx_seg_store), a reader pinned at generation G sees exactly the segments committed <= G, UNAFFECTED by concurrent writers adding gen G+1, G+2... So ingest never blocks or corrupts in-flight queries -- the property that lets the NAS ingest Common Crawl continuously while the site keeps serving. Models the seg_store manifest/generation semantics; live concurrency + seg_store wiring is the scale step. No float. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_index_wr_decouple.nx nx_index_wr_decouple_gate.nx

imports: nx_syscalls.nx

imported by: nx_index_wr_decouple_gate.nx

structs

none

consts

none

functions

11func wr_commit(nseg_box: *i64) -> i64 { nseg_box[0] = nseg_box[0] + 1; return nseg_box[0] }
called by 1: main
13func wr_visible(snapshot_gen: i64, out: *i64) -> i64 { var i: i64 = 0; while i < snapshot_gen { out[i] = i; i = i + 1 } return snapshot_gen }
called by 1: main
15func wr_query(seg_doccount: *i64, snapshot_gen: i64) -> i64 { var s: i64 = 0; var i: i64 = 0; while i < snapshot_gen { s = s + seg_doccount[i]; i = i + 1 } return s }
called by 1: main