code wiki / _hdl_build / nx_pub_ship.nx
nx_pub_ship.nx
buildroot/runtime/_hdl_build/nx_pub_ship.nx
about
nx_pub_ship.nx -- THE NISHI PUBLISHER R3: STAGE + VERIFY transport (composes nx_publisher's primitives,
so nx_publisher.nx itself is untouched -- additive, no collision with the publisher workstream).
For each PENDING request in the queue: ship `src` -> `dest`+".staged" on the NAS via the sovereign sender
(_offc/nx_aw_send.elf -> nx_hostctl recv), read the LANDED bytes back, and VERIFY landed-sha == request-sha.
FAIL-CLOSED: a mismatch / unreadable-landed is NEVER ledgered (retryable; live binary never touched).
On success record STAGED to the ledger (idempotent, rule #10 -- re-run stages 0). STOPS at "staged on NAS":
the atomic promote (rename .staged -> live) + daemon restart stay with the OWNING workstream's supervisor
(coordinate, never brick -- #26). NEVER touches the live binary by construction (only the .staged sibling).
argv (all optional; defaults = the real publish): [1]=queue [2]=ledger [3]=sender-elf [4]=dest-root
[5]=verify-root. dest-root->verify-root maps the NAS path to where the publisher can read it back (the
homes drvfs mount on a WSL-hosted publisher; "/volume1/homes" directly when run on the NAS). license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_publisher.nxnx_syscalls.nxnx_framed_append.nxnx_arbiter.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
| 18 | const SHIP_MAGIC_4096: i64 = 4096 |
| 19 | const SHIP_MAGIC_1024: i64 = 1024 |
| 20 | const SHIP_MAGIC_1100: i64 = 1100 |
| 21 | const SHIP_MAGIC_1200: i64 = 1200 |
| 22 | const SHIP_MAGIC_100000: i64 = 100000 |
| 24 | const SHIP_SENDER: *u8 = "_offc/nx_aw_send.elf" |
| 25 | const SHIP_DEST_ROOT: *u8 = "/volume1/homes" |
| 26 | const SHIP_VERIFY_ROOT: *u8 = "/mnt/nas_homes" |
| 27 | const SHIP_STAGED_SFX: *u8 = ".staged" |
| 28 | const SHIP_LOCKRES: *u8 = "publish:nishifamily" |
functions
| 31 | func ship_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return n } |
| 32 | func ship_puti(v: i64) -> i64 |
| 40 | func ship_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: ship_verify_path |
| 41 | func ship_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 } |
| 42 | func ship_startswith(buf: *u8, pfx: *u8) -> i64 { var i: i64 = 0; while pfx[i] != (0 as u8) { if buf[i] != pfx[i] { return 0 } i = i + 1 } return 1 } called by 1: ship_verify_path |
| 45 | func ship_staged_name(dest: *u8, out: *u8) -> i64 |
| 52 | func ship_verify_path(nas: *u8, dest_root: *u8, verify_root: *u8, out: *u8) -> i64 |
| 61 | func ship_send(sender: *u8, src: *u8, dest: *u8) -> i64 |
| 76 | func ship_record_staged(ledpath: *u8, sha: *u8, dest: *u8, site: *u8) -> i64 |
| 88 | func pub_ship(qpath: *u8, ledpath: *u8, lockres: *u8, sender: *u8, dest_root: *u8, verify_root: *u8) -> i64 |
| 144 | func main(argc: i64, argv: *i64) -> i64 |