ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.Sweep.Pacing

Description

Pure sweep pacing from measured requests and declared capacity, with quotas taking priority over the target window.

Synopsis

The window and the capacity a cycle is paced against

defaultCycleWindow :: NominalDiffTime -> NominalDiffTime Source #

Default window granting each active cycle the same allowance as the pause between cycles.

nominalPackagePace :: Int -> NominalDiffTime -> Rational Source #

The sweep's own nominal package pace, in requests per second. It is the one dial an operator already has over how hard a cycle leans on a store, so both the derived capacity and the share use it.

derivedCapacity :: Rational -> StoreBudget -> StoreBudget Source #

Use the nominal package pace where the backend declares no capacity.

renderScopeBudget :: SweepPacing -> StoreBudget -> Text Source #

Report the resolved capacity, its origin, the share in force, and the per-second ceilings at boot.

The decision the next cycle runs under

data PaceDecision Source #

What one scope's next cycle runs at, and what it cannot reach inside the window.

Constructors

PaceDecision 

Fields

data BudgetShortfall Source #

Why a cycle cannot be paced inside the window, which the warning names.

decidePace :: SweepPacing -> StoreBudget -> Maybe (RequestTally, Rational) -> PaceDecision Source #

Pace the next cycle from measured requests and work outside budget waits. With no sample, use the ceiling.

renderPaceDecision :: SweepPacing -> PaceDecision -> Maybe Text Source #

Warn about an unattainable window while the sweep continues at its request ceiling.