code wiki / _hdl_build / nx_mgmt_data.nx
nx_mgmt_data.nx
buildroot/runtime/_hdl_build/nx_mgmt_data.nx
about
nx_mgmt_data.nx -- the DATA / ADAPTER layer of the management plane (the OUTER ring; secondary adapters).
The ONLY layer that touches the outside world for STATE: it parses snapshot bytes, reads the data-driven
config allowlists, and drives the secondary adapters (the hostctl exec + the real-HTTP health probe). It has
NO knowledge of transport (no HTTP/socket/auth); the IO ring depends on IT, never the reverse (ports &
adapters / dependency inversion). Grounded in knowledge/library/arch_* (three-tier DATA tier, hexagonal
secondary adapters, loose coupling). Reuses the SOTA-gated nx_deploy_lib (validate/exec) + nx_http_health_lib
(probe) -- DRY. license_tier: ORIGINAL
dependencies 7 imports · 3 importers
imports: nx_syscalls.nxnx_connect.nxnx_adnet_invoice.nxnx_adnet_creative.nxnx_deploy_lib.nxnx_http_health_lib.nxnx_tool_run.nx
imported by: nx_mgmt_api.nxnx_promote_deny_gate.nxnx_route_ctl_gate.nx
structs
| none |
consts
| 100 | const MD_ADNET_INV: *u8 = "/volume1/homes/elderwesto/nishihost/sites/nishifamily/synth/adnet_inventory.txt" as *u8 |
| 101 | const MD_ADNET_RATES: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_rates.conf" as *u8 |
| 102 | const MD_ADNET_SERVED: *u8 = "/volume1/homes/elderwesto/nishihost/adnet_impressions.log" as *u8 |
| 103 | const MD_ADNET_CLICKS: *u8 = "/volume1/homes/elderwesto/nishihost/adnet_clicks.log" as *u8 |
| 104 | const MD_ADNET_VIEW: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_viewable.log" as *u8 |
| 111 | const MD_ADNET_SYNTH: *u8 = "/volume1/homes/elderwesto/nishihost/sites/nishifamily/synth/" as *u8 |
| 1428 | const MD_PROV_HIST: *u8 = "knowledge/promote_history.tsv" as *u8 |
| 1429 | const MD_PROV_CAP: i64 = 1048576 |
| 1430 | const MD_PROV_RDCH: i64 = 262144 |
| 1431 | const MD_PROV_FNV_OFF: i64 = 1469598103934665603 |
| 1432 | const MD_PROV_FNV_PRM: i64 = 1099511628211 |
| 1433 | const MD_PROV_TAB: i64 = 9 |
| 1434 | const MD_PROV_NL: i64 = 10 |
| 1585 | const MD_TC_MIN_ELF: i64 = 4096 // size floor: refuse a truncated upload or an HTML error page |
| 1586 | const MD_TC_MODE_EXEC: i64 = 0x1ed // 0755 -- a compiler that is not executable is a dead ecosystem |
functions
| 17 | func md_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 19 | func md_cat_slice(d: *u8, o: i64, src: *u8, off: i64, len: i64) -> i64 |
| 25 | func md_tok_eq(src: *u8, off: i64, len: i64, s: *u8) -> i64 |
| 33 | func md_slice_atoi(src: *u8, off: i64, len: i64) -> i64 |
| 45 | func md_eol(snap: *u8, n: i64, start: i64) -> i64 |
| 55 | func md_split(snap: *u8, ls: i64, le: i64, offs: *i64, lens: *i64, maxf: i64) -> i64 |
| 71 | func md_slice_eq(a: *u8, ao: i64, al: i64, b: *u8, bo: i64, bl: i64) -> i64 |
| 78 | func md_copy_slice_z(dst: *u8, src: *u8, off: i64, len: i64, cap: i64) -> i64 |
| 88 | func md_read_file(path: *u8, szbox: *i64) -> *u8 called by 17: ma_emit_services_filema_emit_health_filema_do_unpackma_do_deployma_do_hostctlma_do_promote+11 calls 1: sys_read_file |
| 113 | func md_adnet_creative_store(b: *u8, n: i64, urlout: *u8, urlcap: i64) -> i64 called by 1: ma_do_adnet_creative calls 7: acr_validatesys_mmapacr_namesys_openat_wrsys_writesys_close+1 |
| 135 | func md_adnet_invoice_report(out: *u8, cap: i64) -> i64 |
| 165 | func md_builtin_target(nm: *u8, off: i64, len: i64, kindb: *i64, srcbuf: *u8, subbuf: *u8, urlbuf: *u8, rbbuf: *u8) -> i64 |
| 190 | func md_resolve_target(cfgpath: *u8, nm: *u8, off: i64, len: i64, kindb: *i64, srcbuf: *u8, subbuf: *u8, urlbuf: *u8, rbbuf: *u8) -> i64 |
| 237 | func md_upload_target_ok(nm: *u8, off: i64, len: i64) -> i64 |
| 296 | func md_unpack_resolve(nm: *u8, off: i64, len: i64, packbuf: *u8, destbuf: *u8) -> i64 |
| 312 | func md_exec_treepack(packpath: *u8, destpath: *u8, outpath: *u8) -> i64 |
| 328 | func md_content_ext_ok(nm: *u8, off: i64, len: i64) -> i64 called by 1: md_content_target_ok |
| 389 | func md_content_pfx(nm: *u8, off: i64, len: i64) -> i64 called by 1: md_content_target_ok |
| 499 | func md_content_target_ok(nm: *u8, off: i64, len: i64) -> i64 |
| 549 | func md_cmp_domain_of(src: *u8, off: i64, len: i64, domb: *u8, cap: i64) -> i64 |
| 584 | func md_cmp_ws(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 585 | func md_cmp_wn(fd: i64, v: i64) -> i64 |
| 602 | func md_cmp_upsert(line: *u8, ln: i64, domb: *u8, domn: i64, replacedb: *i64) -> i64 called by 1: ma_do_cmp_upsert calls 13: sys_mmapmd_read_filemd_eolmd_cmp_domain_ofmd_slice_eqsys_openat_wr+7 |
| 684 | func md_cmp_install(srcp: *u8, tmpp: *u8, prevp: *u8, livep: *u8, firstc: i64) -> i64 called by 2: md_cmp_regenmd_cmp_publish calls 7: sys_mmapmd_read_filesys_openat_wrsys_writesys_closesys_openat_rd+1 |
| 708 | func md_cmp_regen() -> i64 called by 3: ma_do_cmp_upsertma_do_cmp_publishma_do_cmp_regen calls 3: sys_mmapdep_run_capturemd_cmp_install |
| 730 | func md_cmp_dom_ok(src: *u8, off: i64, len: i64, domb: *u8) -> i64 called by 1: ma_do_cmp_publish |
| 753 | func md_cmp_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o + i] = s[i]; i = i + 1 } d[o + i] = 0 as u8; return o + i } |
| 759 | func md_cmp_publish(domb: *u8, kind: i64) -> i64 called by 1: ma_do_cmp_publish calls 9: sys_mmapmd_cmp_catsys_mkdirmd_cmp_installmd_read_filesys_openat_wr+3 |
| 797 | func md_restart_sub(svc: *u8, off: i64, len: i64, subbuf: *u8) -> i64 |
| 807 | func md_direct_restart_ok(svc: *u8, off: i64, len: i64, namebuf: *u8) -> i64 |
| 840 | func md_catn(d: *u8, o: i64, v: i64) -> i64 |
| 853 | func md_route_valid(host: *u8, prefix: *u8, port: i64, mode: *u8) -> i64 |
| 900 | func md_route_append(confp: *u8, host: *u8, prefix: *u8, port: i64, mode: *u8) -> i64 |
| 978 | func md_pk_contains(hay: *u8, hn: i64, needle: *u8, nl: i64) -> i64 |
| 990 | func md_pk_atoi(s: *u8) -> i64 called by 1: md_kill_by_name |
| 1001 | func md_allow_has_name(nm: *u8) -> i64 called by 2: ma_do_tools_registerma_do_cap_mint calls 5: sys_openat_rdsys_mmapsys_readsys_closemd_len |
| 1030 | func md_allow_get_args(nm: *u8, dst: *u8, cap: i64) -> i64 |
| 1083 | func md_allow_update_row(nm: *u8, elfp: *u8, argp: *u8, argn: i64) -> i64 called by 2: ma_do_tools_registermain calls 7: sys_mmapmd_read_filemd_lensys_openat_wrsys_writesys_close+1 |
| 1142 | func md_streq(a: *u8, b: *u8) -> i64 |
| 1158 | func md_contains(a: *u8, sub: *u8) -> i64 |
| 1202 | func md_organ_kind(nm: *u8) -> i64 |
| 1248 | func mdh_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8) { n=n+1 } return n } |
| 1250 | func mdh_tail_eq(nm: *u8, n: i64, suf: *u8) -> i64 |
| 1258 | func md_tok_at(nm: *u8, w: *u8) -> i64 |
| 1278 | func md_name_is_oracle(nm: *u8) -> i64 |
| 1313 | func md_promote_deny_hard(nm: *u8) -> i64 |
| 1323 | func md_promote_deny(nm: *u8) -> i64 |
| 1355 | func md_staged_elf_ok(nm: *u8) -> i64 |
| 1376 | func md_promote_organ_ok(nm: *u8) -> i64 |
| 1437 | func md_prov_hash(path: *u8) -> i64 |
| 1455 | func md_prov_probe(name: *u8, h: i64, out3: *i64) -> i64 |
| 1496 | func md_prov_record(name: *u8, h: i64) -> i64 |
| 1519 | func md_prov_ok(name: *u8, stagedpath: *u8) -> i64 called by 2: md_promote_stagedmd_tc_install calls 4: md_prov_hashsys_mmapmd_prov_probemd_prov_record |
| 1531 | func md_promote_staged(name: *u8) -> i64 called by 2: ma_do_promotema_do_restart calls 7: sys_mmapmd_copy_slice_zsys_openat_rdsys_closemd_prov_oksys_renameat+1 |
| 1588 | func md_toolchain_target_ok(nm: *u8) -> i64 |
| 1595 | func md_tc_live(nm: *u8, buf: *u8) -> i64 |
| 1600 | func md_tc_prev(nm: *u8, buf: *u8) -> i64 |
| 1605 | func md_tc_staged(nm: *u8, buf: *u8) -> i64 |
| 1613 | func md_tc_elf_size(p: *u8) -> i64 |
| 1638 | func md_tc_install(nm: *u8) -> i64 called by 1: ma_do_promote_toolchain calls 8: sys_mmapmd_tc_stagedmd_tc_livemd_tc_prevmd_tc_elf_sizemd_prov_ok+2 |
| 1662 | func md_tc_rollback(nm: *u8) -> i64 called by 1: ma_do_promote_toolchain calls 6: sys_mmapmd_tc_livemd_tc_prevmd_tc_elf_sizesys_renameatnx_chmod |
| 1674 | func md_self_pid() -> i64 { return __syscall(172, 0, 0, 0, 0, 0, 0) } // rv64 getpid=172. Was raw x86 39, which IS an RV64 KEY (umount2) the backend translated to ioctl(16) -> -ENOTTY, so the mgmt API's own pid was -25 (debt idx 2277) called by 1: md_kill_by_name |
| 1678 | func md_delayed_kill(pid: i64, delay_ms: i64) -> i64 |
| 1688 | func md_kill_by_name(needle: *u8) -> i64 called by 2: ma_do_proc_killma_do_restart calls 13: md_lensys_openat_rdsys_mmapsys_getdents64dirent_reclendirent_name+7 |
| 1756 | func md_validate_artifact(path: *u8, kind: i64) -> i64 { return dep_validate(path, kind) } |
| 1759 | func md_exec_hostctl(sub: *u8) -> i64 |
| 1772 | func md_exec_hostctl_capture(sub: *u8, outpath: *u8) -> i64 |
| 1779 | func md_exec_hostctl_capture2(sub: *u8, arg: *u8, outpath: *u8) -> i64 |
| 1807 | func md_exec_build_admit() -> i64 |
| 1834 | func md_exec_gatedry(srcpath: *u8) -> i64 |
| 1847 | func md_name_is_gate(nm: *u8) -> i64 called by 1: ma_do_build |
| 1878 | func md_gate_in_baseline(nm: *u8) -> i64 |
| 1910 | func md_organ_deployed(nm: *u8) -> i64 |
| 1942 | func md_exec_deploy_ready() -> i64 |
| 1959 | func md_exec_capmint(allow: *u8, expstr: *u8, noncestr: *u8, outpath: *u8) -> i64 |
| 1985 | func md_lease_run(verb: *u8, name: *u8, owner: *u8, ttl: *u8, nargs: i64, outpath: *u8) -> i64 |
| 1995 | func md_lease_name(target: *u8, buf: *u8) -> i64 called by 1: ma_do_build |
| 2008 | func md_lease_name_pfx(prefix: *u8, src: *u8, buf: *u8) -> i64 |
| 2026 | func md_gate_name_ok(nm: *u8) -> i64 called by 1: ma_do_gate_run |
| 2046 | func md_exec_gate_capture(elfpath: *u8, out: *u8, cap: i64, outlen: *i64, deadline_ms: i64) -> i64 |
| 2052 | func md_exec_gate_capture_OLD(elfpath: *u8, outpath: *u8, deadline_ms: i64) -> i64 |
| 2058 | func md_str_contains(hay: *u8, pat: *u8) -> i64 |
| 2073 | func md_proc_kill_needle_ok(nm: *u8) -> i64 |
| 2080 | func md_cstr_eq(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 } |
| 2084 | func md_hostctl_action_ok(nm: *u8) -> i64 |
| 2105 | func md_tcp_alive(port: i64) -> i64 |
| 2115 | func md_health_probe(url: *u8) -> i64 |