code wiki / (root) / nx_state_spool_core.nx

nx_state_spool_core.nx

buildroot/runtime/nx_state_spool_core.nx

4756 B113 linesdepth 4pulls 4 transitivereach 2 importersview sourcekind librarytopic state
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_crashresume_census_core.nx nx_state_spool_core.nx nx_state_spool.nx nx_state_spool_gate.nx

imports: nx_syscalls.nxnx_crashresume_census_core.nx

imported by: nx_state_spool.nxnx_state_spool_gate.nx

structs

none

consts

15const K_MAGIC_262144: i64 = 262144
16const K_MAGIC_262143: i64 = 262143
17const K_MAGIC_8192: i64 = 8192
18const K_MAGIC_8191: i64 = 8191

functions

21func ssp_lock(lockpath: *u8) -> i64
29func ssp_unlock(fd: i64) -> i64
35func ssp_spool(spoolpath: *u8, lockpath: *u8, line: *u8) -> i64
50func ssp_run_transport(elf: *u8, line: *u8) -> i64
70func ssp_drain(spoolpath: *u8, lockpath: *u8, tmppath: *u8, elf: *u8, sentp: *i64, keptp: *i64) -> i64