code wiki / _hdl_build / nx_pub_recover_pulse.nx

nx_pub_recover_pulse.nx

buildroot/runtime/_hdl_build/nx_pub_recover_pulse.nx

6592 B123 linesdepth 5pulls 7 transitivereach 3 importersview sourcekind tooltopic pub
docsdependenciesstructsconstsfunctions

about

nx_pub_recover_pulse.nx -- THE PUBLISHER'S SELF-HEALING PULSE (composes the gated decide + execute rungs). One pass = decide (scan the monitor's metrics -> recovery requests, via a DATA-DRIVEN map url-substring-> daemon, rule #11 not hardcoded) then execute (kill the wedged daemon; the existing nx_hostctl keeper respawns a fresh one). Run on a cadence by a scheduler (one pass per invocation; the daemon-loop wrapper is the next rung). This is the Publisher OWNING ops/restarts end-to-end -- NO direct/ad-hoc workstream action, every step a gated Publisher rung. pulse_pass(metricspath, queuepath, ledgerpath, mappath, wedge_ms) -> recoveries executed license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_pub_recover_exec.nx nx_pub_recover_pulse.nx nx_pub_recover_pulse_gate.nx nx_pub_recover_pulsed.nx

imports: nx_syscalls.nxnx_pub_recover_exec.nx

imported by: nx_pub_recover_pulse_gate.nxnx_pub_recover_pulsed.nx

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

main pp_uw sys_write pulse_pass pp_decide sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close pr_field pp_strlen pp_map_lookup sys_mmap ↻ sys_read_file ↻ pr_field ↻ pp_recent_recoveries sys_mmap ↻ sys_read_file ↻ pr_field ↻ fl_acquire fl_try fl_mkdir sys_mmap ↻ fl_path sys_openat_wr sys_flock sys_close ↻ fl_nap sys_mmap ↻ pr_already_pending sys_mmap ↻ sys_read_file ↻ pr_field ↻ pr_streq pr_s fa_appendz fa_append

structs

none

consts

12const PP_MAGIC_100000: i64 = 100000
13const PP_MAGIC_5000: i64 = 5000
15const PP_METRICS: *u8 = "knowledge/status/apm_metrics.tsv"
16const PP_QUEUE: *u8 = "knowledge/publish/recovery_queue.tsv"
17const PP_LEDGER: *u8 = "knowledge/publish/recovery_ledger.tsv"
18const PP_MAP: *u8 = "knowledge/publish/recover_map.tsv" // url-substring<TAB>daemon (data-driven, no hardcode)
19const PP_LOCK: *u8 = "publish_recover"
20const PP_REC_CAP: i64 = 1024
21const PP_COOLDOWN_SEC: i64 = 300 // never kill-storm: at most PP_MAX_RECOVERIES of a daemon per this window
22const PP_MAX_RECOVERIES: i64 = 2 // (#26 never-brick: a daemon that keeps wedging -> BACK OFF, don't re-kill)

functions

24func pp_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: pp_decide
27func pp_recent_recoveries(ledgerpath: *u8, daemon: *u8, now: i64, window: i64) -> i64
49func pp_map_lookup(url: *u8, urllen: i64, mappath: *u8, out: *u8) -> i64
72func pp_decide(metricspath: *u8, queuepath: *u8, ledgerpath: *u8, mappath: *u8, wedge_ms: i64, now: i64) -> i64
112func pulse_pass(metricspath: *u8, queuepath: *u8, ledgerpath: *u8, mappath: *u8, wedge_ms: i64) -> i64
117func pp_uw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
118func main(argc: i64, argv: *i64) -> i64