code wiki / (root) / nx_cell_lib.nx

nx_cell_lib.nx

buildroot/runtime/nx_cell_lib.nx

6732 B157 linesdepth 9pulls 10 transitivereach 1 importersview sourcekind librarytopic cell
docsdependenciesstructsconstsfunctions

about

nx_cell_lib.nx -- ORGANISATION AND PLACE CELLS AS ROWS (shared lib, 2026-08-24). A CELL is one node of the hierarchy a feedback surface rolls up through: a congregation, an agency, a nonprofit program (organisation cells) or a locality, region, nation (place cells). One record kind, one key family, one parent pointer -- the tenant row every multi-organisation surface needs and none had (absence proven 2026-08-24: no tenant lib in 23,167 sources). Composes the survey engine's store discipline: canon-encoded records on the append-only seg_store, latest version wins, history kept. key "cell:<id>" fields type=cell id kind name parent denom usec id a-z 0-9 only, 1..CEL_ID_MAX -- no dash, so "<instrument>-<cell>" survey ids split without ambiguity; CEL_ID_MAX is DERIVED: the engine's survey-id bound is 40 (se_id_ok) and the instrument name is bounded at CEL_INST_MAX, so CEL_INST_MAX + 1 + CEL_ID_MAX == 40. kind must appear in the caller-supplied comma list (conf data, never a literal here) parent another cell id that EXISTS, or "-" for a root; an unknown parent REFUSES by name denom declared denominator (roster size, population) for post-stratification; 0 = undeclared license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_survey_engine.nx nx_cell_lib.nx nx_communitypulse.nx

imports: nx_survey_engine.nx

imported by: nx_communitypulse.nx

structs

none

consts

19const CEL_SURVEY_ID_MAX: i64 = 40 // se_id_ok's bound, restated once so the derivation below is visible
20const CEL_INST_MAX: i64 = 15
21const CEL_ID_MAX: i64 = 24 // CEL_SURVEY_ID_MAX - CEL_INST_MAX - 1 (the dash)
22const CEL_KEY_CAP: i64 = 64
23const CEL_FIELDS: i64 = 16
24const CEL_NUM_BYTES: i64 = 32
25const CEL_WORD: i64 = 8
26const CEL_OK: i64 = 0
27const CEL_ERR_ID: i64 = 0 - 1
28const CEL_ERR_KIND: i64 = 0 - 2
29const CEL_ERR_PARENT: i64 = 0 - 3
30const CEL_ERR_DENOM: i64 = 0 - 4
31const CEL_ERR_STORE: i64 = 0 - 5
32const CEL_ERR_NAME: i64 = 0 - 6
33const CEL_ROOT: *u8 = "-"
34const CEL_ASCII_A: i64 = 97
35const CEL_ASCII_Z: i64 = 122
36const CEL_ASCII_0: i64 = 48
37const CEL_ASCII_9: i64 = 57
38const CEL_ASCII_COMMA: i64 = 44
39const CEL_ASCII_DASH: i64 = 45

functions

41func cel_id_ok(s: *u8) -> i64
55func cel_inst_ok(s: *u8) -> i64
called by 1: cp_instrument calls 2: cel_id_okse_slen
61func cel_kind_ok(kind: *u8, kinds: *u8) -> i64
called by 1: cel_put calls 1: se_slen
83func cel_key(id: *u8, out: *u8) -> i64
called by 2: cel_getcel_put calls 1: se_cat
90func cel_survey_id(inst: *u8, id: *u8, out: *u8) -> i64
97func cel_get(prefix: *u8, id: *u8, ks: *i64, vs: *i64, maxf: i64) -> i64
102func cel_field(ks: *i64, vs: *i64, nf: i64, key: *u8) -> *u8 { return sv_get(ks, vs, nf, key) }
called by 1: cp_load_cells calls 1: sv_get
103func cel_field_n(ks: *i64, vs: *i64, nf: i64, key: *u8, dflt: i64) -> i64 { return se_field_n(ks, vs, nf, key, dflt) }
called by 1: cp_load_cells calls 1: se_field_n
106func cel_put(prefix: *u8, id: *u8, kind: *u8, name: *u8, parent: *u8, denom: i64, kinds: *u8) -> i64
142func cel_list(prefix: *u8, kout: *i64, vout: *i64, lout: *i64, cap: i64) -> i64
called by 1: cp_load_cells calls 1: se_walk_latest