code wiki / _hdl_build / nx_ws_index_lib.nx
nx_ws_index_lib.nx
buildroot/runtime/_hdl_build/nx_ws_index_lib.nx
about
nx_ws_index_lib.nx -- WMS durability LIB: derive the LIVE workstream auto-index from the
memory dir (the actual live source of workstream state) so the resume manifest + a publish
gate can NEVER silently go stale. This is the missing "regenerate-from-source" half the
operator named: every project-*.md becomes a manifest entry by construction, so nothing can
be dropped -- and the count-on-disk vs count-in-manifest comparison turns "we lost a
workstream" into a mechanical RED (the loss-detector), never a silent gap.
REUSE / lineage: the getdents64 + newfstatat directory walk is the proven nx_sov_tree_audit
idiom (ta_getdents/ta_isdir); atomic publish = sys_openat_wr(tmp) + sys_renameat(tmp,live)
(the ss_commit / cst_write_atomic hot-swap discipline). Sovereign: imports only nx_syscalls.
license_tier: ORIGINAL
dependencies 1 imports · 7 importers
imports: nx_syscalls.nx
imported by: nx_discover_loop.nxnx_work_retro_lib.nxnx_worklog_stop.nxnx_ws_discover_gate.nxnx_ws_ingest.nxnx_ws_manifest_emit.nxnx_ws_manifest_emit_gate.nx
structs
| none |
consts
| 13 | const WME_MAGIC_65536: i64 = 65536 |
| 17 | const WME_BEGIN: *u8 = "<!-- WS-AUTO-INDEX:BEGIN (nx_ws_manifest_emit -- generated, do not hand-edit below) -->" |
| 18 | const WME_END: *u8 = "<!-- WS-AUTO-INDEX:END -->" |
| 19 | const WME_MAXF: i64 = 8192 // max workstream records (382 today; headroom) |
| 20 | const WME_SLOT: i64 = 320 // per-name / per-path byte slot |
| 21 | const WME_FBUF: i64 = 1048576 // 1MB: read the existing manifest (curated prefix; ~25KB today) |
| 22 | const WME_OUTBUF: i64 = 1048576 // 1MB: assembled output (bump-mmap is a finite arena -- stay lean) |
functions
| 24 | func wme_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 27 | func wme_getdents(fd: i64, buf: *u8, count: i64) -> i64 { return __syscall(217, fd, buf, count, 0, 0, 0) } |
| 30 | func wme_is_project(name: *u8) -> i64 |
| 43 | func wme_join(dst: *u8, dir: *u8, name: *u8) -> i64 |
| 55 | func wme_read(path: *u8, buf: *u8, cap: i64) -> i64 called by 4: wr_load_corpuswme_count_manifestwme_emitgman_has calls 3: sys_openat_rdsys_readsys_close |
| 69 | func wme_find(buf: *u8, n: i64, pat: *u8) -> i64 |
| 83 | func wme_cat(buf: *u8, off: i64, s: *u8) -> i64 |
| 90 | func wme_catn(buf: *u8, off: i64, v: i64) -> i64 |
| 105 | func wme_scan(memdir: *u8, names: *i64, mtimes: *i64, cap: i64) -> i64 |
| 146 | func wme_count_disk(memdir: *u8) -> i64 |
| 153 | func wme_count_manifest(manifest: *u8) -> i64 |
| 177 | func wme_is_stale(memdir: *u8, manifest: *u8) -> i64 |
| 186 | func wme_write_all(fd: i64, buf: *u8, n: i64) -> i64 |
| 200 | func wme_emit(memdir: *u8, manifest: *u8) -> i64 |