ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Admission.Bytes.Internal

Description

Byte-weighted admission over the shared weighted controller.

Synopsis

Documentation

data ByteAdmission Source #

Process-wide byte capacity and bounded waiting-room state.

newByteAdmission :: Deadlines -> Int -> IO ByteAdmission Source #

Allocate byte capacity, clamped to one, with the shared wait budget timed on the deadlines.

withByteAdmission :: MonadUnliftIO m => MetricsPort -> ByteAdmission -> Int -> m a -> m (Maybe a) Source #

Hold a weight clamped to capacity. A full room or expired wait returns Nothing.

Internals exported for testing

newByteAdmissionTuned :: Deadlines -> Int -> Int -> Int -> IO ByteAdmission Source #

Set the waiting-room bound and microsecond wait budget explicitly.