arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.Concurrency.Schema

Description

Internal to the arbiter packages. Not covered by the PVP.

DDL for the concurrency-limit feature: the seeded per-prefix concurrency policies (with the operator override), the global per-key count table, job columns, and the per-queue delta triggers that maintain the count. No database execution here.

Synopsis

Table names

arbiterConcurrencyTable :: SchemaName -> TextSource #

Qualified name of the global per-key in-flight count table.

arbiterConcurrencyTableName :: TextSource #

Bare name of the in-flight count table, for catalog lookups by relname.

arbiterConcurrencyPoliciesTable :: SchemaName -> TextSource #

Qualified name of the app-global concurrency policies table.

arbiterConcurrencyPoliciesTableName :: TextSource #

Bare name of the concurrency policies table, for catalog lookups by relname.

SQL fragments

concurrencyAdvisoryLockExpr :: Text -> TextSource #

The per-key advisory lock id.

DDL

createConcurrencyPoliciesTableSQL :: SchemaName -> TextSource #

DDL for the concurrency policies table. default_limit is migration-owned. override_limit is management-owned. The effective cap is COALESCE(override, default).

createConcurrencyTableSQL :: SchemaName -> TextSource #

The global per-key UNLOGGED count table, maintained by the delta triggers.

addConcurrencyColumnsSQL :: SchemaName -> TableName -> TextSource #

Migration adding the concurrency columns to a queue's job and DLQ tables. The key is prefix:suffix. concurrency_prefix holds the policy prefix.

createConcurrencyIndexSQL :: SchemaName -> TableName -> TextSource #

Partial index on concurrency_key over keyed jobs, for the recount and the prune.

createConcurrencyTriggerFunctionsSQL :: SchemaName -> TableName -> TextSource #

Per-queue trigger functions maintaining each key's in_flight.

createConcurrencyTriggersSQL :: SchemaName -> TableName -> TextSource #

The three statement-level AFTER triggers on a queue's job table.

upsertConcurrencyPolicyRowSQL :: SchemaName -> ConcurrencyPolicy -> TextSource #

Upsert a policy's default_limit. Any operator override_limit is left untouched.