arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.Concurrency.Schema

Description

DDL for the concurrency-limit feature: the seeded per-prefix pool 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

Source #arbiterConcurrencyTable :: SchemaName -> Text

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

Source #arbiterConcurrencyTableName :: Text

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

Source #arbiterConcurrencyPoliciesTable :: SchemaName -> Text

Qualified name of the app-global pool policies table.

Source #arbiterConcurrencyPoliciesTableName :: Text

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

SQL fragments

Source #concurrencyAdvisoryLockExpr :: Text -> Text

The per-key advisory lock id, identical for the enqueue trigger and the prune.

DDL

Source #createConcurrencyPoliciesTableSQL :: SchemaName -> Text

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

Source #createConcurrencyTableSQL :: SchemaName -> Text

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

Source #addConcurrencyColumnsSQL :: SchemaName -> TableName -> Text

Migration adding the concurrency columns to a queue's job and DLQ tables. The key is prefix:suffix. The prefix is kept separate to join the pool policy.

Source #createConcurrencyIndexSQL :: SchemaName -> TableName -> Text

Index backing the per-key in-flight recount, over claimed jobs.

Source #createConcurrencyTriggerFunctionsSQL :: SchemaName -> TableName -> Text

Per-queue triggers maintaining each key's in_flight.

Source #createConcurrencyTriggersSQL :: SchemaName -> TableName -> Text

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

Source #upsertConcurrencyPolicyRowSQL :: SchemaName -> ConcurrencyPolicy -> Text

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