code wiki / (root) / nx_regbatch_gate.nx

nx_regbatch_gate.nx

buildroot/runtime/nx_regbatch_gate.nx

5975 B133 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_regbatch_gate.nx -- INDEPENDENT GATE: batched durability in reg_put. Correctness FIRST, speed second. INHERITS nx_gate_verdict (D001). A speedup that loses rows is not a speedup, so this gate proves the SAFETY properties before it looks at the clock: u2605VISIBILITY IS NOT DEFERRED. reg_put_deferred writes the segment and renames the manifest exactly as reg_put does -- only the power-loss barrier waits. A row must be readable IMMEDIATELY, before any sync. If that were false the batch would be a lie, so it is asserted first. u2605THE TWO PATHS MUST AGREE BYTE-FOR-BYTE. Same body, two entry points -- proven by writing the same record both ways and comparing what comes back. This is the anti-fork tooth: nx_gate_verdict once forked between trees and an identical migration bought different capability depending on where it ran. One body cannot fork; this check is what keeps it honest. u2605THE INDEX SURVIVES. A batched put must still land in the enumeration index, or a fast write that nothing can find is worse than a slow one. Only then: u2605the batch must actually be faster, or the whole change is unjustified complexity. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_registry.nx nx_gate_verdict.nx nx_regbatch_gate.nx

imports: nx_registry.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap gv_head gv_puts sys_write sys_now_us sys_mmap ↻ sys_clock_gettime_mono rb_cat rb_catn reg_put_deferred reg_put_x sts_lock sts_mm sys_mmap ↻ sts_werr sys_write ↻ sys_exit ss_cat sys_openat_append sts_werr ↻ sys_flock reg_key reg_cat ss_get sys_mmap ↻ ss_scan sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn ss_scan_seglist ss_len sys_mmap ↻ ss_cat ↻ ss_readall ss_r32 reg_strlen reg_id_present sts_unlock

structs

none

consts

none

functions

21func rb_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
called by 1: main
22func rb_catn(dst: *u8, off: i64, v: i64) -> i64
called by 1: main
34func main(argc: i64, argv: *i64) -> i64