code wiki / _hdl_build / nx_mirror_orchestrator.nx

nx_mirror_orchestrator.nx

buildroot/runtime/_hdl_build/nx_mirror_orchestrator.nx

5274 B94 linesdepth 5pulls 5 transitivereach 1 importersview sourcekind librarytopic mirror
docsdependenciesstructsconstsfunctions

about

nx_mirror_orchestrator.nx -- LIB: the UNIFYING "mirror a published open artifact (e.g. Apertus) onto the NAS" flow (the #1 GAP nx_mirror_census surfaced). It COMPOSES shipped sovereign primitives -- it does NOT re-implement them: sha256_digest (nx_sha256, byte-exact integrity), nx_https_fetch_follow (own-TLS HTTP), the BitTorrent+DHT swarm (nx_torrent_get/nx_dht_get_peers/nx_peer_download), nx_aw_send (NAS transport), rcpt_emit (nx_pub_receipt, Ed25519-signed provenance). This file is the pure, deterministic, NEVER-BRICK ORCHESTRATION LOGIC: parse a data-driven manifest row -> resolve the fetch method by scheme (fail-closed on unknown) -> VERIFY the artifact's SHA-256 against the manifest's expected digest (fail-closed = never store a corrupt artifact) -> derive the idempotent content-address key (re-mirror = no-op) -> assemble the provenance-receipt binding in the exact nx_pub_receipt shape. The LIVE dispatch (fetch + NAS push + SIGNED rcpt_emit) is rung-2, gated behind operator confirm (heavy/outward). Additive-only + idempotent by construction (Cardinal 10/13). No main -> built via its _gate. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_sha256.nx nx_syscalls.nx nx_mirror_orchestrator.nx nx_mirror_orchestrator_gate.nx

imports: nx_sha256.nxnx_syscalls.nx

imported by: nx_mirror_orchestrator_gate.nx

structs

none

consts

16const MO_HTTP: i64 = 1
17const MO_TORRENT: i64 = 2
18const MO_REJECT: i64 = 0

functions

20func mo_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
21func mo_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while 1==1 { let ca: i64=a[i] as i64; let cb: i64=b[i] as i64; if ca!=cb {return 0} if ca==0 {return 1} i=i+1 } return 1 }
22func mo_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 }
25func mo_hexenc(inp: *u8, n: i64, out: *u8) -> i64
called by 1: mo_sha_hex
34func mo_scheme_code(scheme: *u8) -> i64
called by 1: main calls 1: mo_streq
43func mo_sha_hex(bytes: *u8, n: i64, out_hex: *u8) -> i64
51func mo_verify(bytes: *u8, n: i64, expect_hex: *u8) -> i64
called by 1: main calls 3: sys_mmapmo_sha_hexmo_streq
59func mo_cas_key(sha_hex: *u8, dest: *u8, out: *u8) -> i64
called by 1: main calls 1: mo_cat
66func mo_receipt_bind(buf: *u8, status: *u8, sha_hex: *u8, dest: *u8, verify: *u8, tsstr: *u8) -> i64
called by 1: main calls 1: mo_cat
77func mo_parse_field(line: *u8, idx: i64, out: *u8) -> i64