ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.Public

Description

Public-read admission, HTTP attempt observation, and response-driven cooldown policy.

Synopsis

Documentation

data PublicControl Source #

One process shares the cooldown handle across its proxy and worker reads.

newPublicControl :: (Text -> PublicReadKind -> ExchangeOutcome -> IO ()) -> (HostPort -> CooldownEvent -> IO ()) -> IO PublicControl Source #

Create the fixed public policy with full jitter above its positive fallback floor.

publicControlWith :: PublicBackoff -> IO UTCTime -> (Text -> PublicReadKind -> ExchangeOutcome -> IO ()) -> PublicControl Source #

Supply the same clock used by an existing cooldown handle, with a non-throwing recorder.

data ReadControl Source #

Private and write exchanges bypass public admission and the public request counter.

withReadControl :: ReadControl -> Request -> (Request -> (Status -> ResponseHeaders -> IO (Maybe RetryAfter)) -> IO a) -> IO (Either FetchFault a) Source #

Observe actual HTTP work after admission. The header callback records status before applying cooldown policy.

classifyPublicResponse :: UTCTime -> Status -> ResponseHeaders -> PublicResponse Source #

Every 429 cools down. A 503 does so only with a valid positive hint, capped at ten minutes.