nx_state_spool_core.nx
buildroot/runtime/nx_state_spool_core.nx
about
nx_state_spool_core.nx -- importable CORE of the STORE-AND-FORWARD state spool (CR-R1a of the
crash-resume->SOTA roadmap, amended 07-15 by operator directive: "the hub is the NAS not the
laptop; the laptop when on network should sync to the NAS as much as possible; when the NAS
isn't available it should go local"). Semantics: capture writes are NAS-FIRST -- a line is
spooled locally, then DRAIN attempts delivery via a PLUGGABLE transport ELF (argv[1]=line,
exit 0 = delivered); delivered lines leave the spool, failed lines are KEPT (offline = nothing
lost) without blocking later lines (head-of-line non-blocking; state lines are latest-wins).
Durability: spool ops serialize under a sidecar flock; drain rewrites via tmp + renameat
(atomic -- a crash mid-drain leaves the old spool or the new one, never a torn file).
Transport is a parameter so the gate proves the semantics OFFLINE; CR-R1 plugs the real
NAS API poster in without touching these mechanics.
license_tier: ORIGINAL
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_crashresume_census_core.nx
imported by: nx_state_spool.nxnx_state_spool_gate.nx
structs
| none |
consts
| 15 | const K_MAGIC_262144: i64 = 262144 |
| 16 | const K_MAGIC_262143: i64 = 262143 |
| 17 | const K_MAGIC_8192: i64 = 8192 |
| 18 | const K_MAGIC_8191: i64 = 8191 |
functions
| 21 | func ssp_lock(lockpath: *u8) -> i64 |
| 29 | func ssp_unlock(fd: i64) -> i64 |
| 35 | func ssp_spool(spoolpath: *u8, lockpath: *u8, line: *u8) -> i64 |
| 50 | func ssp_run_transport(elf: *u8, line: *u8) -> i64 |
| 70 | func ssp_drain(spoolpath: *u8, lockpath: *u8, tmppath: *u8, elf: *u8, sentp: *i64, keptp: *i64) -> i64 |