code wiki / _hdl_build / nx_gen_multiworker_gate.nx
nx_gen_multiworker_gate.nx
buildroot/runtime/_hdl_build/nx_gen_multiworker_gate.nx
about
nx_gen_multiworker_gate.nx -- proves the orchestrator's SOVEREIGN multi-worker dispatch (worker list comes from
cfg = the supervisor's launch command, NO files/TSVs). Real loopback rig: fork the REAL orchestrator (go_serve_conn)
+ a mock GPU worker, then POST /api/generate over TCP:
(1) availability health-check: a listening worker -> up, an unbound port -> down (non-blocking, no hang)
(2) availability selection WITH FAILOVER: a down primary + a down extra are skipped, the request reaches the
one reachable worker (cfg extra #2) and returns CIDs
(3) all workers down -> graceful 503 (never a hang, never a crash)
license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_gen_orchestrator.nxnx_syscalls.nxnx_connect.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 13 | func ig(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 14 | func ig_n(v: i64) -> i64 { var m: i64=v; if m<0{ig("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 } |
| 15 | func ig_row(id: *u8, ok: i64, pass: *i64) -> i64 { ig(" " as *u8); ig(id); ig(": " as *u8); if ok==1 { ig("OK\n" as *u8); pass[0]=pass[0]+1 } else { ig("FAIL\n" as *u8) } return 0 } |
| 16 | func ig_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 } called by 1: main |
| 17 | func ig_catb(dst: *u8, off: i64, src: *u8, n: i64) -> i64 { var o: i64=off; var i: i64=0; while i<n {dst[o]=src[i]; o=o+1; i=i+1} return o } called by 1: main |
| 18 | func ig_itoa(dst: *u8, off: i64, v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var o: i64=off; var q: i64=k-1; while q>=0{dst[o]=t[q];o=o+1;q=q-1} return o } |
| 19 | func ig_find(buf: *u8, n: i64, needle: *u8) -> i64 { var nl: i64=0; while needle[nl]!=(0 as u8){nl=nl+1} if nl==0 {return 0} var i: i64=0; while i+nl<=n { var j: i64=0; var ok: i64=1; while j<nl { if (buf[i+j]&0xff)!=(needle[j]&0xff){ok=0;j=nl} else {j=j+1} } if ok==1 {return i} i=i+1 } return 0-1 } called by 1: ig_has |
| 20 | func ig_has(buf: *u8, n: i64, needle: *u8) -> i64 { if ig_find(buf,n,needle)>=0 {return 1} return 0 } |
| 21 | func ig_nap(ms: i64) -> i64 { let ts: *i64 = sys_mmap(16) as *i64; ts[0]=0; ts[1]=ms*1000000; __syscall(35, ts as i64, 0, 0, 0, 0, 0); return 0 } |
| 22 | func ig_freshns(prefix: *u8) -> i64 { let mfn: *u8 = sys_mmap(256); var mo: i64=0; while (prefix[mo]&0xff)!=0 { mfn[mo]=prefix[mo]; mo=mo+1 } let suf: *u8 = "manifest.txt" as *u8; var so: i64=0; while (suf[so]&0xff)!=0 { mfn[mo+so]=suf[so]; so=so+1 } mfn[mo+so]=0 as u8; let fd: i64 = sys_openat_wr(mfn, 0x1a4); if fd>=0 {sys_close(fd)} return 0 } |
| 24 | func ig_basepng(b: *u8) -> i64 called by 1: main |
| 38 | func ig_enc(v: i64) -> i64 { let x: i64=v&0x3f; if x<26 {return 65+x} if x<52 {return 97+(x-26)} if x<62 {return 48+(x-52)} if x==62 {return 43} return 47 } called by 1: ig_b64encode |
| 39 | func ig_b64encode(inp: *u8, n: i64, out: *u8) -> i64 |
| 51 | func ig_listen(port: i64) -> i64 |
| 63 | func ig_send(port: i64, raw: *u8, rawlen: i64, resp: *u8, cap: i64) -> i64 |
| 89 | func main() -> i64 |