code wiki / _hdl_build / nx_dist_publish_run.nx

nx_dist_publish_run.nx

buildroot/runtime/_hdl_build/nx_dist_publish_run.nx

4203 B67 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind tooltopic dist
docsdependenciesstructsconstsfunctions

about

nx_dist_publish_run.nx -- MAKE IT REAL: a runnable that publishes a REAL file on the NAS into the hub's distribution index (operator: "when we get data on the hub we can pass it to other systems"). Runs ON THE NAS (hashing a 1.25GB shard over 9p would crash WSL). Composes the enabler (nx_dist_publish): SHA-256 the real bytes -> content-id -> BT-v2 magnet + HTTPS url + /api/dist + append a row to /volume1/ai/dist/dist_index.conf (the persistent Napster registry), idempotent (skip if the cid is already present -- the has-cid check is inlined to keep this a single-lib import). Launched by the allowlisted nx_hostctl `distpub` action. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_dist_publish.nx nx_syscalls.nx nx_dist_publish_run.nx

imports: nx_dist_publish.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main w sys_write sys_mmap dp_content_id sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sys_openat_rd sys_read sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sys_close sha256_final blk_set_byte ↻ sha256_compress ↻ dp_hexenc sys_exit sys_openat_rd ↻ sys_read ↻ sys_close ↻ dpr_has_cid sys_mmap ↻ dpr_contains dpr_strlen dp_magnet dp_cat dp_dl_url dp_cat ↻ sys_openat_append sys_openat_wr sys_write ↻ wn w ↻

structs

none

consts

10const K_MAGIC_1048576: i64 = 1048576
11const K_MAGIC_1024: i64 = 1024
12const K_MAGIC_4096: i64 = 4096

functions

14func w(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 2: wnmain calls 1: sys_write
15func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" 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 }
called by 1: main calls 3: wsys_mmapsys_write
16func dpr_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: dpr_contains
17func dpr_contains(hay: *u8, hlen: i64, needle: *u8) -> i64
called by 1: dpr_has_cid calls 1: dpr_strlen
23func dpr_has_cid(buf: *u8, blen: i64, cid: *u8) -> i64
called by 1: main calls 2: sys_mmapdpr_contains
29func main() -> i64