code wiki / (root) / nx_ingest_admit.nx

nx_ingest_admit.nx

buildroot/runtime/nx_ingest_admit.nx

3951 B81 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic ingest
docsdependenciesstructsconstsfunctions

about

nx_ingest_admit.nx -- INGEST ADMISSION CONTROL (/compare/mediaingest R2; contract symbol ig_disk_floor). WHY: a capture path that writes an asset onto a filesystem below its free-space floor risks a TORN write -- a half-written file that then classifies as a real item. Harvestr guards this with min_disk_gb plus a disk manager; ours had the disk axis (sys_fs_avail_bytes, landed in nx_syscalls 2026-08-27) and NOTHING in the capture path read it. This is the one admission check every capture verb calls before it opens a destination. THREE STATES, because "I could not measure the disk" is not "the disk is fine": IG_ADMIT the volume holding <root> has at least <floor> bytes free to a non-root writer IG_REFUSE_FULL measured, and below the floor -- the capture must not write IG_UNMEASURABLE statfs failed (unmounted / permission / gone) -- FAIL-CLOSED: the caller must refuse, because "unmeasurable" read as "empty" is the most flattering possible lie (nx_syscalls says so of the permil twin). A transient statfs failure blocking one capture is safe; a torn write is not. The floor is DATA (rule 11): knowledge/status/ingest_floor.conf holds a single decimal byte count; absent or unreadable falls back to IG_DEFAULT_FLOOR_BYTES, named for its purpose, never buried as a literal at a call site. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_ingest_admit.nx nx_ingest_admit_gate.nx nx_vault_capture.nx

imports: nx_syscalls.nx

imported by: nx_ingest_admit_gate.nxnx_vault_capture.nx

structs

none

consts

20const IG_ADMIT: i64 = 0
21const IG_REFUSE_FULL: i64 = 1
22const IG_UNMEASURABLE: i64 = 2
26const IG_DEFAULT_FLOOR_BYTES: i64 = 5368709120
27const IG_FLOOR_CONF: *u8 = "knowledge/status/ingest_floor.conf"
28const IG_CONF_CAP: i64 = 64

functions

30func ig_atoi(s: *u8, n: i64) -> i64
called by 1: ig_floor_bytes
44func ig_floor_bytes() -> i64
60func ig_decide(avail_bytes: i64, floor_bytes: i64) -> i64
called by 2: ig_disk_floormain
69func ig_disk_floor(root: *u8, out_avail: *i64, out_floor: *i64) -> i64
77func ig_verdict_str(v: i64) -> *u8
called by 2: mainvc_ingest_file