Current circuit state.
Half-open probe slots currently taken.
Optionalopts: CircuitBreakerOptionsAdmit a call or throw UNAVAILABLE. An open circuit turns half-open once
resetTimeoutMs has passed; a half-open circuit admits up to
halfOpenMaxCalls probes.
Record a successful call: closes the circuit.
Record a failed call. Only UNAVAILABLE / INTERNAL / UNKNOWN count; any other code gives back a half-open probe slot. Without an error (legacy callers) the failure counts.
Optionalerror: RpcErrorGive back a half-open probe slot taken by beforeCall for a call whose outcome says nothing about the peer (cancelled, refused by another breaker). Without this the breaker stays half-open with no free slot and refuses every later call.
Circuit breaker for failing endpoints.