code wiki / _hdl_build / nx_doctor_queue.nx
nx_doctor_queue.nx
buildroot/runtime/_hdl_build/nx_doctor_queue.nx
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
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
structs
| none |
consts
| 15 | const DQ_MAGIC_4096: i64 = 4096 |
| 16 | const DQ_MAGIC_100000: i64 = 100000 |
| 17 | const DQ_MAGIC_1024: i64 = 1024 |
| 18 | const DQ_MAGIC_2048: i64 = 2048 |
| 20 | const DQ_DIR: *u8 = "knowledge/doctor" |
| 21 | const DQ_QUEUE: *u8 = "knowledge/doctor/fix_queue.tsv" |
| 22 | const DQ_LEDGER: *u8 = "knowledge/doctor/fix_ledger.tsv" |
| 23 | const DQ_PUMPLOCK: *u8 = "doctor_pump" |
| 24 | const DQ_CAP: i64 = 1048576 |
functions
| 26 | func dq_w(s: *u8) -> i64 { return sys_write(1, s, da_slen(s)) } |
| 27 | func 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 } |
| 28 | func 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 } |
| 29 | func dq_n(dst: *u8, off: i64, v: i64) -> i64 |
| 36 | func dq_field(line: *u8, len: i64, idx: i64, out: *u8, outcap: i64) -> i64 called by 1: doc_pump |
| 47 | func doc_submit(target: *u8, oldpath: *u8, newpath: *u8, requester: *u8) -> i64 |
| 62 | func doc_pump(queue: *u8, ledger: *u8) -> i64 |
| 120 | func main(argc: i64, argv: *i64) -> i64 |