| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Rules.Effectful
Description
The resilience harness around the advisory package read: a per-attempt timeout, bounded retry
with backoff, and a per-rule circuit breaker, attached by prepare.
Any value the read returns resets the breaker unretried, so only a harness-observed fault advances
the breaker and returns a ReadFault. runResilient never throws.
Synopsis
- data Resilience = Resilience {}
- data EffectfulConfig = EffectfulConfig {}
- defaultEffectfulConfig :: EffectfulConfig
- newBreaker :: IO (TVar Breaker)
- runResilient :: Resilience -> IO a -> IO (Either ReadFault a)
- data ReadFault = ReadFault {
- rfTransience :: Transience
- rfReason :: Text
- rfDetail :: Text
The resilience policy
data Resilience Source #
The resilience policy around one advisory rule's reads. Each rule holds its own breaker state.
Constructors
| Resilience | |
Fields
| |
data EffectfulConfig Source #
The resilience knobs around an advisory rule's package read. The breaker's timing reads
resClock fresh at failure commit, not the request snapshot ctxNow.
Constructors
| EffectfulConfig | |
Fields
| |
defaultEffectfulConfig :: EffectfulConfig Source #
A 2-second per-attempt timeout and two retries, at 100ms then 250ms. The breaker trips after 5 consecutive failures and cools for 30 seconds.
newBreaker :: IO (TVar Breaker) Source #
A fresh, healthy breaker (no failures recorded) in a new TVar.
Running a read through it
runResilient :: Resilience -> IO a -> IO (Either ReadFault a) Source #
Run one read under its Resilience policy: the read's value, or why the harness gave it up.
Why the harness gave a read up. Each rule relying on it resolves this under its own alignment.
Constructors
| ReadFault | |
Fields
| |