| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Sql.RateLimit
Description
Internal to the arbiter packages. Not covered by the PVP.
Rate-limit SQL templates.
Synopsis
- defaultThrottleWaitSeconds :: Double
- addRateLimitTokensSQL :: SchemaName -> Text -> Text -> Double -> Query ()
- pruneRateLimitBucketsSQL :: SchemaName -> Double -> Query ()
- resetRateLimitBucketsSQL :: SchemaName -> Text -> Query ()
- wakeThrottledJobsSQL :: SchemaName -> [TableName] -> Text -> Query Int64
- wakeThrottledJobsForKeySQL :: SchemaName -> [TableName] -> Text -> Text -> Query Int64
- refilledExpr :: Text -> Text -> Text -> Text -> Text -> Text
- refilledBucketTokens :: Text
- rateLimitPoliciesSQL :: SchemaName -> [TableName] -> Maybe Text -> Query RateLimitPolicyView
- rateLimitPolicyExistsSQL :: SchemaName -> Text -> Query Bool
- listRateLimitBucketsSQL :: SchemaName -> Text -> Int64 -> Int64 -> Query RateLimitBucketView
- updateRateLimitPolicyOverridesSQL :: SchemaName -> Maybe (Maybe Double) -> Maybe (Maybe Double) -> Maybe (Maybe Double) -> Text -> Query ()
Documentation
defaultThrottleWaitSeconds :: DoubleSource #
Deny-path wait (seconds) when no refill interval yields a real wait.
addRateLimitTokensSQL :: SchemaName -> Text -> Text -> Double -> Query ()Source #
Add amount to a key's bucket, clamped to [0, max], seeding an absent bucket at
full. A no-op without a policy.
pruneRateLimitBucketsSQL :: SchemaName -> Double -> Query ()Source #
Delete idle buckets that have refilled to max.
resetRateLimitBucketsSQL :: SchemaName -> Text -> Query ()Source #
Refill a prefix's buckets to full. The fixed-window reset, which also wakes jobs,
is resetRateLimitBuckets.
wakeThrottledJobsSQL :: SchemaName -> [TableName] -> Text -> Query Int64Source #
Clear the rate-limit deferral on a prefix's throttled jobs. One statement over all given queue tables.
wakeThrottledJobsForKeySQL :: SchemaName -> [TableName] -> Text -> Text -> Query Int64Source #
Like wakeThrottledJobsSQL but for one key, after a top-up.
refilledExpr :: Text -> Text -> Text -> Text -> Text -> TextSource #
A bucket's lazily-refilled token count, capped at maxTokens. Arguments are SQL
expressions.
refilledBucketTokens :: TextSource #
The lazily-refilled token count of the bucket at alias bucket under the policy
at alias policy.
rateLimitPoliciesSQL :: SchemaName -> [TableName] -> Maybe Text -> Query RateLimitPolicyViewSource #
The policy views, every policy or the one a prefix names.
rateLimitPolicyExistsSQL :: SchemaName -> Text -> Query BoolSource #
Whether a rate-limit policy exists for a prefix.
listRateLimitBucketsSQL :: SchemaName -> Text -> Int64 -> Int64 -> Query RateLimitBucketViewSource #
List a prefix's buckets with effective max and lazily-refilled fill fraction, paginated.