| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Registry.Backoff
Description
Process-local public authority cooldowns with one owned recovery request.
Synopsis
- reportingBackoff :: (HostPort -> CooldownEvent -> IO ()) -> PublicBackoff -> PublicBackoff
- data CooldownEvent
- publicRetryAfter :: PublicBackoff -> HostPort -> IO (Maybe RetryAfter)
- data PublicBackoff
- newPublicBackoff :: IO UTCTime -> (RetryAfter -> RetryAfter -> IO RetryAfter) -> IO PublicBackoff
- data PublicAttempt
- withPublicAttempt :: PublicBackoff -> HostPort -> (PublicAttempt -> IO a) -> IO (Either RetryAfter a)
- data PublicResponse
- recordPublicResponse :: PublicAttempt -> PublicResponse -> IO ()
Documentation
reportingBackoff :: (HostPort -> CooldownEvent -> IO ()) -> PublicBackoff -> PublicBackoff Source #
Attach a non-throwing observer. Notifications run after the state transaction commits.
data CooldownEvent Source #
A cooldown opens or a response restores the authority to healthy service.
Constructors
| CoolingDown | |
| Recovered |
Instances
| Show CooldownEvent Source # | |
Defined in Ecluse.Core.Registry.Backoff Methods showsPrec :: Int -> CooldownEvent -> ShowS # show :: CooldownEvent -> String # showList :: [CooldownEvent] -> ShowS # | |
| Eq CooldownEvent Source # | |
Defined in Ecluse.Core.Registry.Backoff Methods (==) :: CooldownEvent -> CooldownEvent -> Bool # (/=) :: CooldownEvent -> CooldownEvent -> Bool # | |
publicRetryAfter :: PublicBackoff -> HostPort -> IO (Maybe RetryAfter) Source #
Read the remaining refusal hint without acquiring a recovery probe.
data PublicBackoff Source #
Share one handle across all public readers. Only pass authorities approved by the public egress policy.
newPublicBackoff :: IO UTCTime -> (RetryAfter -> RetryAfter -> IO RetryAfter) -> IO PublicBackoff Source #
Use the fixed public policy with a fresh clock and jitter selector, clamped to the current fallback interval.
data PublicAttempt Source #
An admitted request may settle once. Its enclosing callback owns its lifetime.
withPublicAttempt :: PublicBackoff -> HostPort -> (PublicAttempt -> IO a) -> IO (Either RetryAfter a) Source #
Refuse a cooling authority without running the callback. Every exit releases an unsettled recovery probe.
data PublicResponse Source #
The caller classifies status and parses any retry hint before reporting the response headers.
Constructors
| NonThrottling | |
| Throttled (Maybe RetryAfter) | A supplied hint must already respect the caller's honoured-header cap. Missing hints use fallback. |
Instances
| Show PublicResponse Source # | |
Defined in Ecluse.Core.Registry.Backoff Methods showsPrec :: Int -> PublicResponse -> ShowS # show :: PublicResponse -> String # showList :: [PublicResponse] -> ShowS # | |
| Eq PublicResponse Source # | |
Defined in Ecluse.Core.Registry.Backoff Methods (==) :: PublicResponse -> PublicResponse -> Bool # (/=) :: PublicResponse -> PublicResponse -> Bool # | |
recordPublicResponse :: PublicAttempt -> PublicResponse -> IO () Source #
Commit response headers before consuming the body. Repeated calls and calls after the callback ends leave state unchanged.