code wiki / (root) / nx_evict_journal.nx

nx_evict_journal.nx

buildroot/runtime/nx_evict_journal.nx

5713 B154 linesdepth 2pulls 2 transitivereach 32 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_evict_journal.nx -- append-only eviction visibility log. Per cardinal: cooperative-resource-arbitration. Every eviction, demote, throttle, and migration is logged so the user can audit after the fact. This is the structural EXCEED-axis vs Docker's silent kernel OOM-killer: there, a container disappears and you dig through dmesg hoping to find the reason. Here, every event is in ~/.nishi/evict.jsonl with the displacing cell named. Composes: nx_budget -- denied-allocation events log here nx_yield -- DEMOTED / THROTTLED outcomes log here nx_homeostasis -- migration decisions log here nx_attention_class -- the class of both displaced + displacing cells is preserved for forensics V1 ships in-memory ring buffer. The on-disk JSONL append is queued once nx_jsonl_writer lands; for now the journal is queryable via nx_evict_dump pointer access. Gap list (V1 honest perf verdict): - no disk persistence (in-memory only this phase) - no time-windowed query (caller walks full buffer) - ring-buffer wraps silently at capacity (older entries lost) - no peer-mesh propagation for distributed evictions genealogy_id: nishi_cardinal_2026-05-17_cooperative_resource_arbitration lineage_id: substrate_evict_journal_v1 nx_safety_envelope: intended_use: "Append-only eviction/demote/throttle log for forensic audit; never silent eviction" sil_target: SIL2 evidence: [append_only_invariant, every_event_logged, displacing_cell_named] verdict: NOT_YET_EVALUATED

dependencies 2 imports · 28 importers

nx_syscalls.nx nx_tier.nx nx_evict_journal.nx nx_ecosystem_compose_test.nx nx_evict_journal_test.nx nx_failover_compose_test.nx nx_homeostasis.nx nx_homeostasis_test.nx nx_immune.nx nx_immune_test.nx nx_lysis.nx nx_lysis_test.nx nx_mimicry_compose_test.nx

diagram shows first 10 each side; +0 more imports, +18 more importers in the complete lists below.

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_ecosystem_compose_test.nxnx_evict_journal_test.nxnx_failover_compose_test.nxnx_homeostasis.nxnx_homeostasis_test.nxnx_immune.nxnx_immune_test.nxnx_lysis.nxnx_lysis_test.nxnx_mimicry_compose_test.nxnx_organism.nxnx_organism_test.nxnx_pollinate.nxnx_pollinate_test.nxnx_promote.nxnx_promote_test.nxnx_reclaim.nxnx_reclaim_test.nxnx_sovereign_compose_test.nxnx_substrate_compose_test.nxnx_symbiote.nxnx_symbiote_test.nxnx_tier1_immune_compose_test.nxnx_tier2_immune_compose_test.nxnx_treaty.nxnx_treaty_test.nxnx_xenocell.nxnx_xenocell_test.nx

structs

62struct NxEvictEntry
77struct NxEvictJournal

consts

43const NX_EVR_BUDGET_DENIED: nx_int = 0
44const NX_EVR_YIELD_DEMOTED: nx_int = 1
45const NX_EVR_YIELD_THROTTLED: nx_int = 2
46const NX_EVR_MIGRATED: nx_int = 3
47const NX_EVR_TERMINATED: nx_int = 4 // immune layer killed the cell
48const NX_EVR_N_REASONS: nx_int = 5
86const NX_EVICT_DEFAULT_CAPACITY: nx_size = 1024

functions

50func nx_evr_is_valid(r: nx_int) -> nx_int
called by 2: nx_evict_logmain
90func nx_evict_journal_new(capacity: nx_size) -> *NxEvictJournal
called by 14: mainmainmainmainmainmain+8 calls 1: sys_mmap
105func nx_evict_log(j: *NxEvictJournal,
132func nx_evict_at(j: *NxEvictJournal, idx: nx_size) -> *NxEvictEntry
called by 4: mainmainmainmain
143func nx_evict_count_for_cell(j: *NxEvictJournal, cell_id: nx_int) -> nx_int
called by 2: mainnx_homeo_check