code wiki / (root) / nx_jrnl_archive_gate_t138.nx

nx_jrnl_archive_gate_t138.nx

buildroot/runtime/nx_jrnl_archive_gate_t138.nx

17299 B319 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind tooltopic jrnl
docsdependenciesstructsconstsfunctions

about

nx_jrnl_archive_gate.nx -- GATE for nx_jrnl_archive (lib composed in-process, nothing forked). The verb's whole contract is PRESERVE-BEFORE-REMOVE, so the load-bearing teeth are the ones where the archive step FAILS and the live journal must come out byte-identical (T6), and the one where the verify step can actually see a corrupted copy (T10 -- a hash compare that cannot fail is not a verify). Fixtures live under /tmp/nx_jrnl_archive_gate_<pid>/ (data only; nothing is executed from /tmp, which the NAS mounts noexec). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_jrnl_archive_lib_t138.nx nx_jrnl_archive_gate_t138.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_jrnl_archive_lib_t138.nx

imported by: nobody (leaf or entry point)

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

main sys_ignore_sigpipe sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ gv_ctr sys_mmap ↻ sys_mmap ↻ ja_cat ja_catn sys_mmap ↻ jg_pid sys_mkdir jg_path sys_mmap ↻ ja_cat ↻ jg_make_journal sys_mmap ↻ ja_catn ↻ ja_cat ↻ ja_write_all sys_openat_wr sys_write ↻ sys_close sys_fsync

structs

none

consts

11const JAG_FIX_LINES: i64 = 40 // enough rows that a short write is detectable, small enough to read by eye
12const JAG_EPOCH_A: i64 = 1700000001 // fixed epochs: archive names must be reproducible across runs
13const JAG_EPOCH_B: i64 = 1700000002
14const JAG_EPOCH_C: i64 = 1700000003
60const JAG_SYNC_TIMEOUT_MS: i64 = 10000

functions

16func jg_pid() -> i64 { return __syscall(172, 0, 0, 0, 0, 0, 0) }
called by 1: main
17func jg_path(base: *u8, leaf: *u8) -> *u8
called by 2: jg_process_gatemain calls 2: sys_mmapja_cat
24func jg_size(path: *u8) -> i64
32func jg_digest(path: *u8, out: *u8) -> i64
41func jg_same(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while i < JA_DIGEST_BYTES { if a[i] != b[i] { return 0 } i = i + 1 } return 1 }
called by 1: main
43func jg_make_journal(path: *u8) -> i64
61func jg_receive(fd: i64, expected: i64) -> i64
69func jg_child_writer(journal: *u8, commands: i64, events: i64) -> i64
93func jg_process_gate(base: *u8, ctr: *i64) -> i64
160func main(argc: i64, argv: *i64) -> i64