code wiki / (root) / nx_plane_migrate.nx

nx_plane_migrate.nx

buildroot/runtime/nx_plane_migrate.nx

9201 B207 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic plane
docsdependenciesstructsconstsfunctions

about

nx_plane_migrate.nx -- migrate a plane's VALUE ENCODING from flat tab-delimited lines to NXR1 records (seq1326 rung 2, the actual retirement). ADDITIVE BY CONSTRUCTION: it writes to a NEW destination prefix and NEVER touches the source, so rule 13 holds and a bad migration costs a wasted prefix, not data. ORDER OF OPERATIONS IS THE SAFETY PROPERTY: 1. load the source with the HONEST loader 2. REFUSE BEFORE WRITING ANYTHING if the read was truncated or the plane was empty -- migrating a partial read would silently drop rows into a plane that then looks authoritative. This is the lesson nx_plane_check taught me by catching my own false GREEN: a checker that has not seen every row must never act as if it has. 3. write every row as NXR1 under the same q:<seq> key 4. VERIFY by reading the destination back and rendering each record to TSV, comparing byte-for-byte against the source line. Verification reads the STORE, not the in-memory buffer, so it exercises the real commit path rather than trusting the writer. WHY THE KEY STAYS q:<seq> FOR NOW: this rung changes the ENCODING only. Re-keying to business keys is a separate rung with its own blast radius, and doing both at once would make a failure impossible to attribute. One change, one gate. EXIT: 0 migrated+verified · 2 usage · 3 verify mismatch · 4 source empty · 6 source read TRUNCATED 7 too many rows for the row table · 8 commit failed license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_record_tsv.nx nx_store_seed_lib.nx nx_plane_migrate.nx

imports: nx_record_tsv.nxnx_store_seed_lib.nx

imported by: nobody (leaf or entry point)

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

main pm_cat pm_len sts_load_honest ss_open_cached ssc_init sys_mmap ssc_sig_of ss_cat sys_fstatat ssc_streq ss_open ss_open2 sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn ss_cat ↻ ss_loadfile sys_map_file ss_readall ss_load_aux2 sys_mmap ↻ ss_cat ↻ ss_loadfile ↻ ss_r32 sys_munmap ssl_total_keys ss_r32 ↻ ssl_pow2 ssl_build ss_r32 ↻ ssl_hash_entry ssl_key_eq ss_r32 ↻ ssl_lookup ssl_hash_entry ↻ ssl_key_eq ↻ ss_manifest_free sys_munmap ↻ sys_munmap ↻

structs

none

consts

26const PM_CAP: i64 = 16777216
27const PM_RECCAP: i64 = 262144
28const PM_OUTCAP: i64 = 262144
29const PM_MSGCAP: i64 = 4096
30const PM_TYPECAP: i64 = 512
31const PM_FLAGS: i64 = 64
32const PM_MAXROWS: i64 = 65536
33const PM_KEYCAP: i64 = 64
34const PM_NUMCAP: i64 = 32
35const PM_SLACK: i64 = 1048576
36const PM_GROWTH: i64 = 3 // NXR1 adds 7B/field + 6B header; 3x the flat bytes is a safe arena
37const PM_NL: i64 = 10
38const PM_CH_I: i64 = 105
39const PM_STDOUT: i64 = 1
40const PM_KIND_LIVE: i64 = 1
41const PM_EXIT_USAGE: i64 = 2
42const PM_EXIT_MISMATCH: i64 = 3
43const PM_EXIT_EMPTY: i64 = 4
44const PM_EXIT_TRUNCATED: i64 = 6
45const PM_EXIT_TOOMANY: i64 = 7
46const PM_EXIT_COMMIT: i64 = 8
47const PM_EXIT_LOSSY: i64 = 9

functions

49func pm_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
50func pm_cat(d: *u8, off: i64, s: *u8) -> i64
called by 1: main
56func main(argc: i64, argv: *i64) -> i64