ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.Sweep.Pacing.Internal

Description

The arithmetic Ecluse.Core.Registry.Sweep.Pacing decides a cycle's pace with: the seconds a cycle has, the share of a scope's capacity it may take, and the seconds a tally of requests costs at that share.

Importing this module opts out of the public surface's stability promises. It exists so a spec can pin each step of the derivation against the decision built from it.

Synopsis

Documentation

cycleAllowance :: SweepPacing -> Rational Source #

The seconds one complete cycle has. A name newly covered by an advisory can miss the running cycle's selection, so the window must cover that cycle, the pause, and the next one.

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.

budgetFraction :: SweepPacing -> StoreBudget -> Rational Source #

The share of a scope's capacity the sweep may take: the configured fraction, else the smaller of half the capacity and the share the nominal package pace already implies.

ceilingsFor :: Rational -> StoreBudget -> Map QuotaDimension Rational Source #

The per-second ceilings one scope holds itself to under that share.

cycleDemand :: Map QuotaDimension Rational -> StoreBudget -> RequestTally -> Rational Source #

The seconds a tally of requests takes at those ceilings. Each attempt costs the longest its own dimensions hold it to, and the cycle makes them one at a time, so the costs add.

data BudgetShortfall Source #

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

Constructors

WorkFillsAllowance

The cycle's own work fills the allowance, so no request share reaches the window.

NeedsFraction Rational

The window needs this share of the scope's capacity, above the ceiling in force.