code wiki / _hdl_build / nx_apistack_breaker.nx

nx_apistack_breaker.nx

buildroot/runtime/_hdl_build/nx_apistack_breaker.nx

1545 B34 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic apistack
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_apistack_breaker.nx nx_apistack_breaker_gate.nx

imports: nx_syscalls.nx

imported by: nx_apistack_breaker_gate.nx

structs

none

consts

8const CB_CLOSED: i64 = 0
9const CB_OPEN: i64 = 1
10const CB_HALF: i64 = 2

functions

13func cb_allow(cb: *i64, now: i64, cooldown: i64) -> i64
called by 1: main
24func cb_record(cb: *i64, success: i64, threshold: i64, now: i64) -> i64
called by 1: main