| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Server.Admission.Weighted
Description
Shared weighted admission for serve slots and publish bytes. A bounded waiting room prevents newcomers from bypassing queued requests. Wake order is not FIFO. The room's wait runs on the deadline sweeper, and each freed place wakes the gate's overflow line.
Synopsis
- data WeightedAdmission
- weightedAdmissionWaiting :: WeightedAdmission -> STM Int
- weightedAdmissionLine :: WeightedAdmission -> Line
- newWeightedAdmission :: Deadlines -> Int -> Int -> Int -> IO WeightedAdmission
- withWeightedAdmission :: MonadUnliftIO m => AdmissionObservers -> WeightedAdmission -> Int -> m a -> m (Either Shed a)
- data AdmissionObservers = AdmissionObservers {}
- admissionWaitMicros :: Int
Documentation
data WeightedAdmission Source #
Capacity and waiting-room state. Only the controller can mutate these fields.
weightedAdmissionWaiting :: WeightedAdmission -> STM Int Source #
Observe committed waiting-room occupancy without changing admission state.
weightedAdmissionLine :: WeightedAdmission -> Line Source #
The line of requests this gate turned away at a full room.
newWeightedAdmission :: Deadlines -> Int -> Int -> Int -> IO WeightedAdmission Source #
Keep capacity verbatim and clamp the room and microsecond wait budget at zero. A positive wait ends on a sweep of the deadlines, so a fixture that never waits one out may leave them unswept.
withWeightedAdmission :: MonadUnliftIO m => AdmissionObservers -> WeightedAdmission -> Int -> m a -> m (Either Shed a) Source #
Hold the supplied weight through the action, or say why the gate turned the request away.
data AdmissionObservers Source #
Admission observers, independent of the telemetry vocabulary.
Constructors
| AdmissionObservers | |
admissionWaitMicros :: Int Source #
Wait one second, matching the shed response Retry-After hint.