| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Sql.RateLimit
Description
RateLimit 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
- listRateLimitPoliciesSQL :: SchemaName -> [TableName] -> Query RateLimitPolicyView
- getRateLimitPolicySQL :: SchemaName -> [TableName] -> Text -> Query RateLimitPolicyView
- rateLimitPolicyExistsSQL :: SchemaName -> Text -> Query Bool
- listRateLimitBucketsSQL :: SchemaName -> Text -> Int64 -> Int64 -> Query RateLimitBucketView
- updateRateLimitOverridesSQL :: SchemaName -> Maybe (Maybe Double) -> Maybe (Maybe Double) -> Maybe (Maybe Double) -> Text -> Query ()
Documentation
Source #defaultThrottleWaitSeconds :: Double
Deny-path wait (seconds) when no refill interval yields a real wait.
Source #addRateLimitTokensSQL :: SchemaName -> Text -> Text -> Double -> Query ()
Add amount to a key's bucket, clamped to [0, max], seeding an absent bucket at
full. A no-op without a policy.
Source #pruneRateLimitBucketsSQL :: SchemaName -> Double -> Query ()
Delete idle buckets that have refilled to max.
Source #resetRateLimitBucketsSQL :: SchemaName -> Text -> Query ()
Refill a prefix's buckets to full. The fixed-window reset, which also wakes jobs, is the HighLevel resetRateLimitBuckets.
Source #wakeThrottledJobsSQL :: SchemaName -> [TableName] -> Text -> Query Int64
Clear the rate-limit deferral on a prefix's throttled jobs. One statement over all given queue tables.
Source #wakeThrottledJobsForKeySQL :: SchemaName -> [TableName] -> Text -> Text -> Query Int64
Like wakeThrottledJobsSQL but for one key, after a top-up.
Source #refilledExpr :: Text -> Text -> Text -> Text -> Text -> Text
A bucket's lazily-refilled token count, capped at maxTokens. Arguments are SQL
expressions.
Source #listRateLimitPoliciesSQL :: SchemaName -> [TableName] -> Query RateLimitPolicyView
List every policy with its default/override params and per-prefix bucket aggregates (count, min and average of lazily-refilled tokens, live throttled count over the given queue tables).
Source #getRateLimitPolicySQL :: SchemaName -> [TableName] -> Text -> Query RateLimitPolicyView
Single-prefix variant of listRateLimitPoliciesSQL.
Source #rateLimitPolicyExistsSQL :: SchemaName -> Text -> Query Bool
Whether a rate-limit policy exists for a prefix.
Source #listRateLimitBucketsSQL :: SchemaName -> Text -> Int64 -> Int64 -> Query RateLimitBucketView
List a prefix's buckets with effective max and lazily-refilled fill fraction, paginated.