code wiki / (root) / nx_crm_store.nx

nx_crm_store.nx

buildroot/runtime/nx_crm_store.nx

12420 B280 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind tooltopic crm
docsdependenciesstructsconstsfunctions

about

nx_crm_store.nx -- PERSISTENCE for deals + giving (the DEPTH rung after full-presence 1000): the pipeline and the church statements survive across runs on the sovereign APPEND-ONLY seg_store (additive, tombstone-not-delete, content-addressed = tamper-evident, on YOUR hardware -- the CRM exceed made concrete for the money records). Records: key "dea:"+cid {kind=dea,name,account,amount,stage} ยท key "giv:"+cid {kind=giv,donor,fund,amount,gtype}. THE DEPTH PROOF: the weighted forecast and the household giving statement are recomputed FROM THE STORE and must equal the in-memory oracles of nx_crm/nx_org ($122,500 forecast; $1,350 received) -- two independent paths, one truth. Saves VALIDATE (unknown stage / bad gift type = LOUD -1, nothing committed). Additivity proven: a second commit adds a deal and the recomputed forecast moves exactly (+Lead 40000 -> +4000 weighted). Composes the nx_crm pure core (stage_prob/stage_open/gift vocab lives beside) + canon_cid + seg_store. Argless = selftest gate. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_crm.nx nx_canon_cid.nx nx_seg_store.nx nx_crm_store.nx

imports: nx_crm.nxnx_canon_cid.nxnx_seg_store.nx

imported by: nobody (leaf or entry point)

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

main p sys_write slen ss_cat ss_catn sys_mmap sys_now_us sys_mmap ↻ sys_clock_gettime_mono ss_begin ss_begin_cap sys_mmap ↻ cs_save_deal stage_valid seq p ↻ ss_catn ↻ canon_encode sys_mmap ↻ cc_cmp cc_w32 cc_len sys_munmap cid_of sys_mmap ↻ sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word sha256_final blk_set_byte ↻ sha256_compress ↻

structs

none

consts

14const K_MAGIC_2048: i64 = 2048
15const K_MAGIC_50000: i64 = 50000
16const K_MAGIC_120000: i64 = 120000
17const K_MAGIC_30000: i64 = 30000
18const K_MAGIC_20000: i64 = 20000
19const K_MAGIC_200000: i64 = 200000
20const K_MAGIC_122500: i64 = 122500
21const K_MAGIC_1350: i64 = 1350
22const K_MAGIC_40000: i64 = 40000
23const K_MAGIC_240000: i64 = 240000
24const K_MAGIC_126500: i64 = 126500

functions

26func cs_kmemeq(b: *u8, off: i64, n: i64, s: *u8) -> i64
called by 2: cs_iskindcs_field calls 1: slen
32func cs_iskind(b: *u8, koff: i64, kl: i64, pfx: *u8) -> i64
called by 2: cs_forecastcs_giving calls 1: cs_kmemeq
36func cs_field(rec: *u8, rl: i64, want: *u8, out: *u8, cap: i64) -> i64
59func cs_atoi(s: *u8) -> i64
69func cs_gift_ok(t: *u8) -> i64
called by 1: cs_save_gift calls 1: seq
78func cs_save_deal(w: *i64, name: *u8, account: *u8, amount: i64, stage: *u8) -> i64
101func cs_save_gift(w: *i64, donor: *u8, fund: *u8, amount: i64, gtype: *u8) -> i64
124func cs_forecast(prefix: *u8, out: *i64) -> i64
172func cs_giving(prefix: *u8, fundfilter: *u8, out: *i64) -> i64
216func main() -> i64