code wiki / _hdl_build / nx_apistack_breaker.nx
nx_apistack_breaker.nx
buildroot/runtime/_hdl_build/nx_apistack_breaker.nx
about
nx_apistack_breaker.nx -- CAP-API-BREAKER: per-dependency circuit-breaker for /api downstream calls. Pure state
machine CLOSED -> (threshold failures) OPEN -> (cooldown) HALF-OPEN -> (probe) CLOSED|OPEN. When OPEN it fails fast
(no wasted calls to a dead dependency); one probe in HALF-OPEN decides recovery. Pure integer logic, gateable
offline = the sovereign exceed over a library breaker (no framework, deterministic). Caller holds per-dependency
state cb[0]=status cb[1]=fail_count cb[2]=open_since. license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_apistack_breaker_gate.nx
structs
| none |
consts
| 8 | const CB_CLOSED: i64 = 0 |
| 9 | const CB_OPEN: i64 = 1 |
| 10 | const CB_HALF: i64 = 2 |
functions
| 13 | func cb_allow(cb: *i64, now: i64, cooldown: i64) -> i64 called by 1: main |
| 24 | func cb_record(cb: *i64, success: i64, threshold: i64, now: i64) -> i64 called by 1: main |