code wiki / (root) / nx_recovery.nx

nx_recovery.nx

buildroot/runtime/nx_recovery.nx

5248 B142 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic recovery
docsdependenciesstructsconstsfunctions

about

nx_recovery.nx -- recovery procedure invocation. When nx_health_check fires RED + nx_health_should_trigger_recovery returns 1, the substrate fires nx_recovery_execute. Recovery sequences a series of mitigations: 1. Pause new cell admission 2. nx_lysis on any confirmed-hostile xenocells 3. nx_promote any cells in ABORTIVE state 4. nx_aerobic mark stale resources for decomposition 5. Write a RED-triggered book entry (severity=ALERT) 6. Notify operator (via book unseen-alerts count) Per [[feedback-captain-moroni-doctrine]]: recovery is DEFENSIVE. We never attack back. We restore substrate function for the user. Composes: nx_health_check -- supplies the RED verdict that triggers nx_lysis -- selective foreign-entity neutralization nx_promote -- failover from compromised to backup cell nx_aerobic -- decompose stale resources cleanly nx_book -- RED transition logged as ALERT entry

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_recovery.nx nx_audit_compose_test.nx nx_recovery_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_audit_compose_test.nxnx_recovery_test.nx

structs

43struct NxRecoverySession

consts

26const NX_RC_OK: nx_int = 0
27const NX_RC_ERR_BAD_PHASE: nx_int = 1
28const NX_RC_ERR_NOT_TRIGGERED: nx_int = 2
32const NX_RP_NOT_STARTED: nx_int = 0
33const NX_RP_PAUSE_ADMISSION: nx_int = 1
34const NX_RP_LYSE_HOSTILE: nx_int = 2
35const NX_RP_PROMOTE_BACKUPS: nx_int = 3
36const NX_RP_DECOMPOSE_STALE: nx_int = 4
37const NX_RP_NOTIFY_OPERATOR: nx_int = 5
38const NX_RP_COMPLETE: nx_int = 6
39const NX_RP_N_PHASES: nx_int = 7

functions

53func nx_rp_is_valid(p: nx_int) -> nx_int
called by 1: main
59func nx_recovery_new(session_id: nx_int, now_us: nx_size) -> *NxRecoverySession
called by 2: mainmain calls 1: sys_mmap
78func nx_recovery_advance(r: *NxRecoverySession, now_us: nx_size) -> nx_int
89func nx_recovery_record_lysed(r: *NxRecoverySession, n: nx_int) -> nx_int
95func nx_recovery_record_promoted(r: *NxRecoverySession, n: nx_int) -> nx_int
101func nx_recovery_record_composted(r: *NxRecoverySession, n: nx_int) -> nx_int
107func nx_recovery_phase(r: *NxRecoverySession) -> nx_int
called by 1: main
111func nx_recovery_is_complete(r: *NxRecoverySession) -> nx_int
called by 2: mainmain
116func nx_recovery_duration_us(r: *NxRecoverySession) -> nx_size
called by 1: main
127func nx_recovery_run_full(r: *NxRecoverySession,