code wiki / _hdl_build / nx_store_put.nx

nx_store_put.nx

buildroot/runtime/_hdl_build/nx_store_put.nx

44812 B813 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic store
docsdependenciesstructsconstsfunctions

about

nx_store_put.nx -- THE UNIFIED INFORMATION-PLANE WRITE VERB (operator 2026-07-18: "it shouldnt be on the tsv we are supposed to use a unified nishi information management plane system thats better than git ... not just debt it should be new feature capable"). Row-level, provenanced, additive writes DIRECTLY against any 7-col seg-store plane (id title sev status owner scope note) -- debt-, work- (features), or any sibling prefix. Flat staging files demote to bootstrap/recovery; the LIVE write path is this verb. BETTER-THAN-GIT properties, in-plane: every mutation appends a revision to <prefix minus '-'>hist- as epoch<TAB>actor<TAB>verb<TAB>id<TAB>old-row<TAB>new-row (inner tabs -> '|'), so history + provenance live in the SOVEREIGN plane itself -- no working tree, no index, no merge dance; row-independent writes cannot conflict, and the full before/after of every row is queryable. nx_store_put <prefix> put <actor> <id> <field>... (N-col: id + 1..15 fields, ANY plane schema incl the 9-col frontier -- v2 uplevel 07-18, operator: "stop engaging with the tsv") nx_store_put <prefix> setcol <actor> <id> <colidx> <value> (flip ONE cell, e.g. frontier status col5 T->D) nx_store_put <prefix> close <actor> <id> <closing-note> (7-col convention: col3 open->closed, note appended) nx_store_put <prefix> load (dump the plane) nx_store_put <prefix> hist (dump the revision plane) put on an unseeded prefix BOOTSTRAPS the plane (first row creates it -- no staging file needed). close/setcol are FAIL-CLOSED: unknown id (or colidx past the row) -> exit 4, store untouched. Whole-store last-writer-wins per write; writers serialized socially by session claims (flock = next rung). ROW-LEVEL COMMITS (2026-09-02, loadgov LV17): put/close/setcol commit ONE row -- sts_append_fast for a new id, sts_replace_fast (overwrite q:<seq>, newest-wins, no reader change) for an existing one. The whole-plane sts_seed is now only the bootstrap of an unseeded plane and the fallback when a row cannot be located by seq; the shrink guard stays on that fallback. MEASURED CAUSE: five whole-plane reseeds in flight held the RAID in D-state and refused every build on the estate for hours (2026-09-02). license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_store_seed_lib.nx nx_seg_store.nx nx_syscalls.nx nx_store_put.nx

imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main nsp_werr sys_write nsp_slen sys_exit sts_lock sts_mm sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sts_werr sys_write ↻ sys_exit ↻ ss_cat sys_openat_append sts_werr ↻ sys_flock nsp_eqs sys_mmap ↻ sts_load_fit sts_mm ↻ sts_load sts_gen_note sts_pfxhash ss_max_segid sys_mmap ↻ ss_cat ↻ ss_readall

structs

none

consts

29const NSP_MAGIC_4096: i64 = 4096
49const NSP_CAP: i64 = 33554432
50const NSP_NL: i64 = 10
51const NSP_TAB: i64 = 9
52const NSP_PIPE: i64 = 124
53const NSP_DASH: i64 = 45
54const NSP_NCOL: i64 = 7
55const NSP_PAIR: i64 = 2
56const NSP_SP_BYTES: i64 = 128
57const NSP_STDERR: i64 = 2
58const NSP_PFXCAP: i64 = 256
59const NSP_MSGCAP: i64 = 256
60const NSP_ARGC_PUT_MIN: i64 = 6 // prog prefix put actor id + at least 1 more field
61const NSP_ARGC_PUT_MAX: i64 = 20 // id + up to 15 fields (16-col plane cap)
62const NSP_ARGC_CLOSE: i64 = 6 // prog prefix close actor id note
63const NSP_ARGC_SETCOL: i64 = 7 // prog prefix setcol actor id colidx value
64const NSP_ARGC_MIN: i64 = 3
65const NSP_MAXCOL: i64 = 16 // max columns a plane row may carry
66const NSP_SP2_BYTES: i64 = 256 // 16 cols * 2 slots * 8B
67const NSP_EXIT_USAGE: i64 = 2
68const NSP_EXIT_IO: i64 = 1
69const NSP_EXIT_REFUSED: i64 = 4
75const NSP_HASH: i64 = 35 // '#': comment lines in a records file are skipped, like a staging buffer
76const NSP_BATCH_MAX: i64 = 4096
77const NSP_F_RECFILE: i64 = 4 // putmany argv: prog prefix putmany actor recfile
78const NSP_ARGC_PUTMANY: i64 = 5
80const NSP_F_ACTOR: i64 = 3
81const NSP_F_ID: i64 = 4
82const NSP_F_LAST: i64 = 10
84const NSP_C_ID: i64 = 4
85const NSP_C_NOTE: i64 = 5
87const NSP_COL_STATUS: i64 = 3
88const NSP_COL_NOTE: i64 = 6

functions

90func nsp_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
91func nsp_werr(s: *u8) -> i64 { sys_write(NSP_STDERR, s, nsp_slen(s)); return 0 }
92func nsp_eqs(a: *u8, b: *u8) -> i64
called by 1: main
100func nsp_slice_eq_slice(qa: *u8, a1: i64, b1: i64, qb: *u8, a2: i64, b2: i64) -> i64
called by 1: main
106func nsp_slice_eqs(q: *u8, a: i64, b: i64, s: *u8) -> i64
called by 1: main calls 1: nsp_slen
114func nsp_cols(q: *u8, ls: i64, le: i64, sp: *i64) -> i64
called by 1: main
129func nsp_cat_slice(d: *u8, o: i64, q: *u8, a: i64, b: i64) -> i64
called by 1: main
136func nsp_cat_slice_pipe(d: *u8, o: i64, q: *u8, a: i64, b: i64) -> i64
called by 2: nsp_hist_appendmain
149func nsp_hist_prefix(prefix: *u8, out: *u8) -> i64
called by 2: nsp_hist_appendmain calls 2: nsp_slenss_cat
159func nsp_hist_append(prefix: *u8, actor: *u8, verb: *u8, id: *u8, q: *u8, olda: i64, oldb: i64, neu: *u8, na: i64, nb: i64) -> i64
200func nsp_atoi_span(q: *u8, n: i64) -> i64
215func nsp_hist_commit_rows(hp: *u8, rows: *u8, offs: *i64, lens: *i64, k: i64) -> i64
259func nsp_atoi(s: *u8) -> i64
called by 1: main
270func nsp_report(verb: *u8, id: *u8, replaced: i64, rows: i64) -> i64
called by 1: main calls 4: sys_mmapss_catss_catnsys_write
296func nsp_would_shrink(prefix: *u8, rows: i64) -> i64
called by 1: main calls 3: sys_mmapss_getsts_atoi
305func nsp_refuse_shrink(vname: *u8) -> i64
called by 1: main calls 1: nsp_werr
312func main(argc: i64, argv: *i64) -> i64