code wiki / (root) / nx_statuscensus.nx

nx_statuscensus.nx source

↩ module page · 27 lines · 1687 B

1// nx_statuscensus.nx -- TS11 (/compare/trafficsafety): STATUS ANALYTICS + THE NON-EMPTY-200 SLA GAUGE, the PROGRAM. 2// Runs the ONE classifier in nx_statuscensus_lib.nx over the live journals (the edge's sites_telemetry.log tail 3// window and the tools API's actlog.jrnl), truncate-writes the LEVEL to knowledge/status/statuscensus.status 4// (canonical verdict= LAST line) and appends one row per run to knowledge/status/statuscensus.log (the 5// TRAJECTORY). Bars come from knowledge/statuscensus.conf (window_bytes= sla_permil_min= min_rows=); an absent 6// conf announces src=default. Exit 0 GREEN / 1 RED / 3 UNOBSERVED. The gate nx_statuscensus_gate drives the same 7// lib over planted fixtures, so it cannot disagree with this program on a bucket. 8// license_tier: ORIGINAL No hw writes (Rule 26). 9import "nx_statuscensus_lib.nx" 10 11const SC_TEL_PATH: *u8 = "sites_telemetry.log" 12const SC_ACT_PATH: *u8 = "knowledge/status/actlog.jrnl" 13const SC_STATUS_PATH: *u8 = "knowledge/status/statuscensus.status" 14const SC_STATUS_TMP: *u8 = "knowledge/status/statuscensus.status.tmp" 15const SC_LOG_PATH: *u8 = "knowledge/status/statuscensus.log" 16 17func main() -> i64 { 18 let wsrc: *i64 = sys_mmap(16) as *i64 19 let ssrc: *i64 = sys_mmap(16) as *i64 20 let msrc: *i64 = sys_mmap(16) as *i64 21 let window: i64 = sc_conf("window_bytes=" as *u8, SC_WINDOW_DEFAULT, wsrc) 22 let slamin: i64 = sc_conf("sla_permil_min=" as *u8, SC_SLA_MIN_DEFAULT, ssrc) 23 let minrows: i64 = sc_conf("min_rows=" as *u8, SC_MINROWS_DEFAULT, msrc) 24 let rc: i64 = sc_run(SC_TEL_PATH, SC_ACT_PATH, SC_STATUS_PATH, SC_STATUS_TMP, SC_LOG_PATH, window, wsrc[0], slamin, minrows) 25 sys_exit(rc) 26 return rc 27}