ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Admission.Internal

Description

Unit-slot admission over the shared weighted controller, and the overflow queue that both metadata gates' refusals share. The composition root builds both with the process's sweeper. A runtime built without the queue refuses a full room at once.

Synopsis

Documentation

data ServeAdmission Source #

Process-wide serve capacity and its bounded waiting room, and the overflow queue when it is on.

newServeAdmission :: Deadlines -> Int -> IO ServeAdmission Source #

Allocate positive capacity, a waiting room of the same size, and an overflow queue for it. The deadlines must be swept, as the composition root's are, or a queued request never times out.

withServeAdmission :: MonadUnliftIO m => MetricsPort -> ServeAdmission -> m a -> m (Either Shed a) Source #

Hold one slot for the action, or say why the gate turned the request away.

serveAdmissionLine :: ServeAdmission -> Line Source #

The line of requests the serve slots' full room turned away.

serveAdmissionOverflow :: ServeAdmission -> Maybe Overflow Source #

The overflow queue in front of the gates, when it is on.

Internals exported for testing

newServeAdmissionTuned :: Deadlines -> Int -> Int -> Int -> IO ServeAdmission Source #

Set the waiting-room bound and microsecond wait budget explicitly, with no overflow queue.

withOverflow :: ServeAdmission -> Overflow -> ServeAdmission Source #

Put an overflow queue in front of the gates.