code wiki / _hdl_build / nx_pub_ship.nx

nx_pub_ship.nx

buildroot/runtime/_hdl_build/nx_pub_ship.nx

8015 B159 linesdepth 6pulls 10 transitivereach 0 importersview sourcekind tooltopic pub
docsdependenciesstructsconstsfunctions

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

nx_publisher.nx nx_syscalls.nx nx_framed_append.nx nx_arbiter.nx nx_pub_ship.nx

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

main pub_init pub_queue_default pub_ledger_default pub_ship sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ship_puts sys_write pub_field pub_streq ship_staged_name ship_cat fl_acquire fl_try fl_mkdir sys_mmap ↻ fl_path sys_openat_wr sys_flock sys_close ↻ fl_nap sys_mmap ↻ pub_led_has sys_mmap ↻ sys_read_file ↻ pub_field ↻ pub_streq ↻ sys_munmap ship_send sys_fork sys_mmap ↻ sys_execve sys_exit sys_wait4

structs

none

consts

18const SHIP_MAGIC_4096: i64 = 4096
19const SHIP_MAGIC_1024: i64 = 1024
20const SHIP_MAGIC_1100: i64 = 1100
21const SHIP_MAGIC_1200: i64 = 1200
22const SHIP_MAGIC_100000: i64 = 100000
24const SHIP_SENDER: *u8 = "_offc/nx_aw_send.elf"
25const SHIP_DEST_ROOT: *u8 = "/volume1/homes"
26const SHIP_VERIFY_ROOT: *u8 = "/mnt/nas_homes"
27const SHIP_STAGED_SFX: *u8 = ".staged"
28const SHIP_LOCKRES: *u8 = "publish:nishifamily"

functions

31func 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 }
called by 2: pub_shipmain calls 1: sys_write
32func ship_puti(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
40func 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
41func 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 }
42func 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
45func ship_staged_name(dest: *u8, out: *u8) -> i64
called by 1: pub_ship calls 1: ship_cat
52func ship_verify_path(nas: *u8, dest_root: *u8, verify_root: *u8, out: *u8) -> i64
61func ship_send(sender: *u8, src: *u8, dest: *u8) -> i64
76func ship_record_staged(ledpath: *u8, sha: *u8, dest: *u8, site: *u8) -> i64
called by 1: pub_ship calls 3: sys_mmapfa_catfa_appendz
88func pub_ship(qpath: *u8, ledpath: *u8, lockres: *u8, sender: *u8, dest_root: *u8, verify_root: *u8) -> i64
144func main(argc: i64, argv: *i64) -> i64