code wiki / (root) / nx_swarm_endpoint_lib.nx

nx_swarm_endpoint_lib.nx

buildroot/runtime/nx_swarm_endpoint_lib.nx

8952 B245 linesdepth 2pulls 2 transitivereach 13 importersview sourcekind librarytopic swarm
docsdependenciesstructsconstsfunctions

about

nx_swarm_endpoint_lib.nx -- THE one act every swarm caller performs: resolve a ROLE to an ADDRESS. WHY (a live outage, measured 2026-07-30): the laptop GPU endpoint was a hardcoded string literal in FIVE files -- nx_mesh_lb:42, nx_swarm_coord:66, nx_worker_dispatch:67, nx_hostctl:268, nx_mgmt_api:456. DHCP moved the box from .193 to .192 and all five went stale in the same instant. nx_swarm_coord:66 even carried the comment "worker_dispatch SSOT" while COPYING the value -- a claimed single source of truth that was really a fifth duplicate. Meanwhile sd-server sat HEALTHY on the 5080 and all four swarm gates read GREEN, because a gate that measures the PLAN does not measure the REACHABILITY. LAW APPLIED: a fix that must be remembered at N sites has to bind to the ONE act all N perform. That act is this function. Callers ask for a role; nobody spells an address again. LAYER: lives in runtime/ (the PRIMITIVE layer) precisely so BOTH runtime/ organs and _hdl_build/ organs can import it -- the import edge is directed and primitives may not depend on tools (seq1450). Library only: NO main(), so any organ can import it without a duplicate entry. FAIL-CLOSED: unknown role or unreadable table returns 0, never a fabricated address. A wrong endpoint fails SILENTLY at dispatch; a missing one fails LOUDLY at resolve. Prefer loud. The table is re-read on every call (~1KB), so an address edit takes effect with no restart. license_tier: ORIGINAL

dependencies 1 imports · 7 importers

nx_syscalls.nx nx_swarm_endpoint_lib.nx nx_gen_orchestrator.nx nx_mesh_lb.nx nx_se_addr_probe.nx nx_swarm_coord.nx nx_swarm_endpoint.nx nx_worker_dispatch.nx nx_write.nx

imports: nx_syscalls.nx

imported by: nx_gen_orchestrator.nxnx_mesh_lb.nxnx_se_addr_probe.nxnx_swarm_coord.nxnx_swarm_endpoint.nxnx_worker_dispatch.nxnx_write.nx

structs

none

consts

24const K_MAGIC_65536: i64 = 65536
25const K_MAGIC_65535: i64 = 65535

functions

27func se_len(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i }
called by 2: se_seqse_has
29func se_put(o: *u8, at: i64, s: *u8) -> i64
36func se_putn(o: *u8, at: i64, buf: *u8, off: i64, n: i64) -> i64
43func se_putd(o: *u8, at: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
55func se_ceq(a: *u8, b: *u8) -> i64
called by 1: main
66func se_seq(buf: *u8, off: i64, n: i64, s: *u8) -> i64
called by 1: se_find calls 1: se_len
74func se_has(buf: *u8, off: i64, n: i64, needle: *u8) -> i64
called by 1: main calls 1: se_len
89func se_field(buf: *u8, s: i64, e: i64, idx: i64, box: *i64) -> i64
called by 1: se_ctx
112func se_slurp(path: *u8, buf: *u8, cap: i64) -> i64
128func se_ctx() -> *i64
174func se_find(ctx: *i64, role: *u8) -> i64
called by 3: se_addrse_descse_addr_desc calls 1: se_seq
189func se_addr(role: *u8) -> *u8
204func se_host(role: *u8) -> *u8
called by 1: ml_where_role calls 2: se_addrsys_mmap
219func se_desc(role: *u8) -> *u8
232func se_addr_desc(role: *u8) -> *u8