code wiki / _hdl_build / nx_doctor_queue.nx

nx_doctor_queue.nx

buildroot/runtime/_hdl_build/nx_doctor_queue.nx

7771 B134 linesdepth 4pulls 4 transitivereach 1 importersview sourcekind tooltopic doctor
docsdependenciesstructsconstsfunctions

about

nx_doctor_queue.nx -- THE NISHI DOCTOR's serialized fix INTAKE (so a fix is literally "sent to the Doctor" and applied one-at-a-time, no competition). Mirrors the Publisher's submit->queue->ship: workstreams SUBMIT (append a PENDING fix request); the Doctor PUMPS (drains PENDING one-at-a-time under a pump-lock, applying each via the gated graceful doc_apply_mem, flipping the queue line to APPLIED/CONFLICT/AMBIGUOUS, ledgering). Idempotent (rule #10): only PENDING lines are processed; a re-run pumps 0. RACI: the Doctor APPLIES; the Engineer re-verifies + the Warden admits (separate roles) -- this organ never blesses its own work. queue line (TSV): status<TAB>ts<TAB>requester<TAB>target<TAB>oldstr-path<TAB>newstr-path usage: nx_doctor_queue submit <target> <oldstr-file> <newstr-file> <requester> nx_doctor_queue pump license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_arbiter.nx nx_doctor_apply.nx nx_doctor_queue.nx nx_doctor_queue_gate.nx

imports: nx_syscalls.nxnx_arbiter.nxnx_doctor_apply.nx

imported by: nx_doctor_queue_gate.nx

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

main dq_w sys_write da_slen dq_streq doc_submit sys_mkdir sys_mmap dq_cat dq_n sys_mmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_openat_append sys_write ↻ sys_close doc_pump fl_acquire fl_try fl_mkdir sys_mmap ↻ fl_path sys_openat_wr sys_flock sys_close ↻ fl_nap sys_mmap ↻ sys_mmap ↻ da_read sys_openat_rd sys_read sys_close ↻ fl_release sys_flock ↻ sys_close ↻ dq_field dq_streq ↻ doc_apply_mem fl_acquire ↻

structs

none

consts

15const DQ_MAGIC_4096: i64 = 4096
16const DQ_MAGIC_100000: i64 = 100000
17const DQ_MAGIC_1024: i64 = 1024
18const DQ_MAGIC_2048: i64 = 2048
20const DQ_DIR: *u8 = "knowledge/doctor"
21const DQ_QUEUE: *u8 = "knowledge/doctor/fix_queue.tsv"
22const DQ_LEDGER: *u8 = "knowledge/doctor/fix_ledger.tsv"
23const DQ_PUMPLOCK: *u8 = "doctor_pump"
24const DQ_CAP: i64 = 1048576

functions

26func dq_w(s: *u8) -> i64 { return sys_write(1, s, da_slen(s)) }
called by 1: main calls 2: sys_writeda_slen
27func dq_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
called by 2: doc_pumpmain
28func dq_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64 = off; var i: i64 = 0; while s[i] != (0 as u8) { dst[o] = s[i]; o = o + 1; i = i + 1 } return o }
called by 2: doc_submitdoc_pump
29func dq_n(dst: *u8, off: i64, v: i64) -> i64
called by 2: doc_submitmain calls 1: sys_mmap
36func dq_field(line: *u8, len: i64, idx: i64, out: *u8, outcap: i64) -> i64
called by 1: doc_pump
47func doc_submit(target: *u8, oldpath: *u8, newpath: *u8, requester: *u8) -> i64
62func doc_pump(queue: *u8, ledger: *u8) -> i64
120func main(argc: i64, argv: *i64) -> i64