| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Server.Admission
Contents
Description
Brief-wait admission for metadata-bearing serve work: the unit-slot instance of
Ecluse.Core.Server.Admission.Weighted, at weight one with the room equal to the capacity.
It adds only the serve-path metric hooks. A refused request is silently Nothing here,
because the serve path records its own unavailability.
Synopsis
- data ServeAdmission
- newServeAdmission :: Int -> IO ServeAdmission
- withServeAdmission :: MonadUnliftIO m => MetricsPort -> ServeAdmission -> m a -> m (Maybe a)
- newServeAdmissionTuned :: Int -> Int -> Int -> IO ServeAdmission
Documentation
data ServeAdmission Source #
A process-wide serve admission handle. The constructor is hidden so only the checked acquire/wait/release operations can mutate its capacity and waiting room.
newServeAdmission :: Int -> IO ServeAdmission Source #
Allocate a handle with the given positive capacity, a waiting room of the same size, and
the shared admissionWaitMicros budget, so a burst of twice the cap queues briefly.
withServeAdmission :: MonadUnliftIO m => MetricsPort -> ServeAdmission -> m a -> m (Maybe a) Source #
Run an action within the admission bound. Nothing means the caller should shed it: the
room was full, or no slot freed within the wait budget.
Internals exported for testing
newServeAdmissionTuned :: Int -> Int -> Int -> IO ServeAdmission Source #
Allocate a handle with an explicit room bound and wait budget (microseconds), so a test exercises the queueing without real-second sleeps. A room of zero is acquire-or-refuse.