code wiki / (root) / nx_store_seed_lib.nx

nx_store_seed_lib.nx

buildroot/runtime/nx_store_seed_lib.nx

25835 B455 linesdepth 4pulls 5 transitivereach 354 importersview sourcekind librarytopic store
docsdependenciesstructsconstsfunctions

about

nx_store_seed_lib.nx -- THE canonical GENERIC store-seed codec (operator 2026-07-17: unify the ~30 bespoke per-plane seeders). Migrates ANY flat staging buffer (# and blank lines skipped) into ANY sovereign seg-store prefix as records key "q:<seq>"=row + "q:n"=count, and reconstructs a newline-joined buffer byte-identical to the flat body. Prefix is a PARAMETER (gates isolate). This is nx_frontier_store's frs_* promoted to the shared home; frontier + commontask delegate here. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 114 importers

nx_seg_store.nx nx_syscalls.nx nx_record_tsv.nx nx_store_seed_lib.nx nx_archcensus.nx nx_asset_page.nx nx_atlas_discover.nx nx_atlas_discover_gate.nx nx_atlas_gapscan.nx nx_atlas_gapscan_gate.nx nx_atlas_graphrec.nx nx_atlas_graphrec_lib.nx nx_backlog_feeder.nx nx_battery_grade.nx

diagram shows first 10 each side; +0 more imports, +104 more importers in the complete lists below.

imports: nx_seg_store.nxnx_syscalls.nxnx_record_tsv.nx

imported by: nx_archcensus.nxnx_asset_page.nxnx_atlas_discover.nxnx_atlas_discover_gate.nxnx_atlas_gapscan.nxnx_atlas_gapscan_gate.nxnx_atlas_graphrec.nxnx_atlas_graphrec_lib.nxnx_backlog_feeder.nxnx_battery_grade.nxnx_bench_ingest.nxnx_browser_census.nxnx_cap_harvest.nxnx_carflip_deal.nxnx_clawf_route.nxnx_clock_sched.nxnx_clockjobs.nxnx_consolidate.nxnx_consolidate_gate.nxnx_ctxcost.nxnx_cwe_scan.nxnx_cwe_scan_gate.nxnx_dbtc_ppmi_probe2.nxnx_dbthyg.nxnx_debt.nxnx_debt_hygiene.nxnx_debt_plane_check.nxnx_debt_plane_gate.nxnx_debtcluster.nxnx_debtlive.nxnx_dedup_candidates.nxnx_dedup_migrate.nxnx_dmkt_ideator.nxnx_dora.nxnx_eco_scorecard.nxnx_eco_scorecard_gate.nxnx_editor_board.nxnx_eff_board_lib.nxnx_favela_census.nxnx_favela_census_gate.nxnx_feed.nxnx_fetchprobec.nxnx_flip_lib.nxnx_frontier_put.nxnx_frontier_store.nxnx_gen_orchestrator.nxnx_gen_rank.nxnx_gmmlu_ingest.nxnx_hw_envelope.nxnx_info_registry.nxnx_ingest_base.nxnx_input_scan.nxnx_jobhealth_gate.nxnx_k3_arch_census.nxnx_k3_arch_census_gate.nxnx_kind.nxnx_landed_cost.nxnx_langintel_axismap.nxnx_langintel_router.nxnx_law_warden.nxnx_libdata.nxnx_model_card.nxnx_netobs.nxnx_patch_guard.nxnx_plan_run.nxnx_plan_run_gate.nxnx_plane_append.nxnx_plane_check.nxnx_plane_migrate.nxnx_plane_repair.nxnx_plane_repair_gate.nxnx_planecap_gate.nxnx_pm_board.nxnx_pm_board_gate.nxnx_pm_dashboard.nxnx_pm_roi_lib.nxnx_product_atlas_build.nxnx_product_board.nxnx_product_decompose.nxnx_promptpack.nxnx_pub_desk.nxnx_pub_lib.nxnx_pub_reconcile.nxnx_registry.nxnx_regprof_test.nxnx_research_flow_gate.nxnx_research_ocean.nxnx_research_river.nxnx_rulers_page.nxnx_seat.nxnx_sheriff.nxnx_sheriff_gate.nxnx_sov_guard2.nxnx_sov_guard2_gate.nxnx_store_compact.nxnx_store_hist.nxnx_store_put.nxnx_store_put_gate.nxnx_store_put_shrink_gate.nxnx_store_seed.nx +14 more (shown cap 100 declared)

structs

none

consts

11const STS_WCAP: i64 = 8388608 // RETIRED as the writer cap (see sts_seed); kept only for callers that still name it
12const STS_ROWOVH: i64 = 32 // per-entry seg-store header: kind + u32 klen + u32 vlen, with margin
13const STS_WSLACK: i64 = 65536 // count row + commit slack
46const STS_HASH: i64 = 35 // '#'
47const STS_NL: i64 = 10 // '\n'
48const STS_Q: i64 = 113 // 'q'
49const STS_COLON: i64 = 58 // ':'
50const STS_ZERO: i64 = 48 // '0'
51const STS_NINE: i64 = 57 // '9'
52const STS_KIND_LIVE: i64 = 1 // seg-store live-record kind (2 = tombstone)
53const STS_KEYCAP: i64 = 64
54const STS_NUMCAP: i64 = 28
55const STS_OUTCAP: i64 = 16
56const STS_BASE10: i64 = 10
57const STS_KPFX: i64 = 2 // "q:" prefix length
58const STS_EXIT_MMAP: i64 = 9
59const STS_MMAP_ERRMAX: i64 = 4096
60const STS_PROBE_WINDOW: i64 = 4096 // detect-only probe span past the declared q:n
61const STS_PROBE_MISS_RUN: i64 = 64 // consecutive misses that end the probe (sparse-tail guard)
62const STS_ERRFD: i64 = 2
81const STS_NXR_HDR: i64 = 6
82const STS_NXR_N: i64 = 78
83const STS_NXR_X: i64 = 88
84const STS_NXR_R: i64 = 82
85const STS_NXR_1: i64 = 49
367const STS_LOCK_EX: i64 = 2
368const STS_LOCK_UN: i64 = 8
369const STS_LOCKMODE: i64 = 420
370const STS_LOCKPATHCAP: i64 = 256
371const STS_ERR_LOCK: i64 = 0 - 3
372const STS_ERR_CAP: i64 = 0 - 4

functions

70func sts_werr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(STS_ERRFD, s, n); return 0 }
71func sts_mm(n: i64) -> *u8
96func sts_emit_row(src: *u8, vl: i64, out: *u8, off: i64, cap: i64) -> i64
112func sts_atoi(b: *u8, n: i64) -> i64
125func sts_rowkey(seq: i64, out: *u8) -> i64
133func sts_seed(prefix: *u8, buf: *u8, n: i64) -> i64
210func sts_append_fast(prefix: *u8, row: *u8, rowlen: i64) -> i64
253func sts_load(prefix: *u8, out: *u8, cap: i64) -> i64
301func sts_load_honest(prefix: *u8, out: *u8, cap: i64, flags: *i64) -> i64
376func sts_lock(prefix: *u8) -> i64
392func sts_unlock(fd: i64) -> i64
404func sts_append_row(prefix: *u8, row: *u8, rowlen: i64, cap: i64) -> i64
424func sts_append_fast_locked(prefix: *u8, row: *u8, rowlen: i64) -> i64
434func sts_load_slow(prefix: *u8, out: *u8, cap: i64) -> i64