code wiki / _hdl_build / nx_ws_kickoff_sync.nx

nx_ws_kickoff_sync.nx

buildroot/runtime/_hdl_build/nx_ws_kickoff_sync.nx

13945 B303 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic ws
docsdependenciesstructsconstsfunctions

about

nx_ws_kickoff_sync.nx -- CR-R1b MECHANICAL WORKSTREAM CAPTURE: the "sync from kickoff, survive interruptions" rung of the orchestration north-star (Pillar 7). A workstream KICKS OFF, BEATS its state continuously, DONEs on completion; the append-only journal IS the resume surface -- a crash costs nothing but reading it. Each frame is ONE O_APPEND write (atomic for <4KB lines on one host) so PARALLEL sessions converge without clobber (the coindex append-and-derive property). license_tier: ORIGINAL expect_exit: 0 kickoff <journal> <ws> <actor> <note> beat <journal> <ws> <actor> <note> done <journal> <ws> <actor> <note> resume <journal> -> in-flight (KICKOFF w/o DONE) + last checkpoint = resume list board <journal> [window_sec] -> per-ws latest state + liveness (ACTIVE/STALE/DONE) selftest <journal> -> gate T1..T6 (caller pre-cleans the path); exit 0 iff all pass

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_ws_kickoff_sync.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main ks_puts sys_write sys_exit ks_lit_eq ks_vlen ks_selftest sys_mmap ks_puts ↻ ks_assert ks_puts ↻ ks_putn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap ks_inflight sys_mmap ↻ ks_read sys_openat_rd sys_read sys_close ks_le ks_col ks_lit_eq ↻ ks_first_kick sys_mmap ↻ ks_le ↻ ks_col ↻ ks_lit_eq ↻ ks_span_eq ks_has sys_mmap ↻ ks_le ↻ ks_col ↻ ks_lit_eq ↻ ks_span_eq ↻ ks_append

structs

none

consts

15const K_MAGIC_4096: i64 = 4096
16const K_MAGIC_262144: i64 = 262144
17const K_MAGIC_262140: i64 = 262140
18const K_MAGIC_3600: i64 = 3600

functions

20func ks_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
25func ks_putn(v: i64) -> i64 { nxi_out(v); return 0 }
26func ks_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ d[o]=s[i]; o=o+1; i=i+1 } return o }
called by 1: ks_append
27func ks_catn(d: *u8, o: i64, v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0} 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; while i<k{d[o]=t[k-1-i];o=o+1;i=i+1} return o }
called by 1: ks_append calls 1: sys_mmap
28func ks_vlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: main
29func ks_atoi_z(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64; if c>=48 { if c<=57 { v=v*10+(c-48) } } i=i+1 } return v }
called by 1: main
32func ks_append(journal: *u8, ts: i64, verb: *u8, ws: *u8, actor: *u8, note: *u8) -> i64
53func ks_read(path: *u8, buf: *u8, cap: i64) -> i64
62func ks_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64
77func ks_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64
83func ks_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64
89func ks_atoi(q: *u8, s: i64, e: i64) -> i64
called by 1: ks_last_ts
95func ks_le(q: *u8, i: i64, n: i64) -> i64
101func ks_has(q: *u8, n: i64, verb: *u8, ws_s: i64, ws_e: i64) -> i64
115func ks_has_lit(q: *u8, n: i64, verb: *u8, ws: *u8) -> i64
129func ks_first_kick(q: *u8, upto: i64, ws_s: i64, ws_e: i64) -> i64
143func ks_last_ts(q: *u8, n: i64, ws_s: i64, ws_e: i64) -> i64
158func ks_print_last_note(q: *u8, n: i64, ws_s: i64, ws_e: i64) -> i64
174func ks_resume(q: *u8, n: i64) -> i64
197func ks_board(q: *u8, n: i64, window: i64) -> i64
220func ks_assert(name: *u8, got: i64, want: i64, fails: *i64) -> i64
called by 1: ks_selftest calls 2: ks_putsks_putn
226func ks_inflight(journal: *u8) -> i64
244func ks_selftest(journal: *u8) -> i64
276func main(argc: i64, argv: *i64) -> i64