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 3 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.nxnx_logtail.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 16 | const K_MAGIC_2000: i64 = 2000 |
| 17 | const K_MAGIC_3000: i64 = 3000 |
| 19 | const K_MAGIC_4096: i64 = 4096 |
| 20 | const K_MAGIC_262144: i64 = 262144 |
| 21 | const K_MAGIC_262140: i64 = 262140 |
| 22 | const K_MAGIC_3600: i64 = 3600 |
| 83 | const K_JRNL_BUF: i64 = 8388608 |
| 84 | const K_JRNL_RD: i64 = 8388600 |
| 280 | const K_IX_MAX: i64 = 4096 |
| 281 | const K_IX_STRIDE: i64 = 9 |
functions
| 24 | 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 } |
| 29 | func ks_putn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 30 | 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 } |
| 31 | func ks_catn(d: *u8, o: i64, v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; if m<0{d[o]=45 as u8;o=o+1;m=0-m} 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 } |
| 32 | func ks_vlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 33 | 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 } |
| 36 | func ks_append(journal: *u8, ts: i64, verb: *u8, ws: *u8, actor: *u8, note: *u8) -> i64 |
| 57 | func ks_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 90 | func ks_env_print(env: *i64) -> i64 |
| 100 | func ks_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64 |
| 115 | func ks_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 121 | func ks_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64 |
| 127 | func ks_atoi(q: *u8, s: i64, e: i64) -> i64 |
| 133 | func ks_le(q: *u8, i: i64, n: i64) -> i64 |
| 139 | func ks_has(q: *u8, n: i64, verb: *u8, ws_s: i64, ws_e: i64) -> i64 |
| 162 | func ks_last_ts_verb(q: *u8, n: i64, verb: *u8, ws_s: i64, ws_e: i64) -> i64 |
| 188 | func ks_closed(q: *u8, n: i64, ws_s: i64, ws_e: i64) -> i64 |
| 205 | func ks_has_lit(q: *u8, n: i64, verb: *u8, ws: *u8) -> i64 |
| 219 | func ks_first_kick(q: *u8, upto: i64, ws_s: i64, ws_e: i64) -> i64 |
| 233 | func ks_last_ts(q: *u8, n: i64, ws_s: i64, ws_e: i64) -> i64 |
| 248 | func ks_print_last_note(q: *u8, n: i64, ws_s: i64, ws_e: i64) -> i64 |
| 283 | func ks_ix_find(ix: *i64, cnt: i64, q: *u8, s: i64, e: i64) -> i64 |
| 292 | func ks_ix_build(q: *u8, n: i64, ix: *i64) -> i64 |
| 335 | func ks_ix_closed(ix: *i64, k: i64) -> i64 |
| 343 | func ks_resume(q: *u8, n: i64) -> i64 |
| 379 | func ks_board(q: *u8, n: i64, window: i64) -> i64 |
| 418 | func ks_assert(name: *u8, got: i64, want: i64, fails: *i64) -> i64 |
| 428 | func ks_inflight_ref(journal: *u8) -> i64 |
| 449 | func ks_inflight(journal: *u8) -> i64 |
| 463 | func ks_selftest(journal: *u8) -> i64 |
| 563 | func main(argc: i64, argv: *i64) -> i64 |