code wiki / _hdl_build / nx_ws_kickoff_sync.nx
nx_ws_kickoff_sync.nx
buildroot/runtime/_hdl_build/nx_ws_kickoff_sync.nx
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
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
structs
| none |
consts
| 15 | const K_MAGIC_4096: i64 = 4096 |
| 16 | const K_MAGIC_262144: i64 = 262144 |
| 17 | const K_MAGIC_262140: i64 = 262140 |
| 18 | const K_MAGIC_3600: i64 = 3600 |
functions
| 20 | func 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 } |
| 25 | func ks_putn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 26 | func 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 |
| 27 | func 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 } |
| 28 | func ks_vlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: main |
| 29 | func 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 |
| 32 | func ks_append(journal: *u8, ts: i64, verb: *u8, ws: *u8, actor: *u8, note: *u8) -> i64 called by 2: ks_selftestmain calls 7: sys_now_realtime_secsys_mmapks_catnks_catsys_openat_appendsys_write+1 |
| 53 | func ks_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 62 | func ks_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64 |
| 77 | func ks_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 83 | func ks_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64 |
| 89 | func ks_atoi(q: *u8, s: i64, e: i64) -> i64 called by 1: ks_last_ts |
| 95 | func ks_le(q: *u8, i: i64, n: i64) -> i64 |
| 101 | func ks_has(q: *u8, n: i64, verb: *u8, ws_s: i64, ws_e: i64) -> i64 |
| 115 | func ks_has_lit(q: *u8, n: i64, verb: *u8, ws: *u8) -> i64 |
| 129 | func ks_first_kick(q: *u8, upto: i64, ws_s: i64, ws_e: i64) -> i64 |
| 143 | func ks_last_ts(q: *u8, n: i64, ws_s: i64, ws_e: i64) -> i64 |
| 158 | func ks_print_last_note(q: *u8, n: i64, ws_s: i64, ws_e: i64) -> i64 |
| 174 | func ks_resume(q: *u8, n: i64) -> i64 |
| 197 | func ks_board(q: *u8, n: i64, window: i64) -> i64 |
| 220 | func ks_assert(name: *u8, got: i64, want: i64, fails: *i64) -> i64 |
| 226 | func ks_inflight(journal: *u8) -> i64 |
| 244 | func ks_selftest(journal: *u8) -> i64 |
| 276 | func main(argc: i64, argv: *i64) -> i64 |