arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.Sql.Concurrency

Description

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

Concurrency SQL templates.

Synopsis

Documentation

updateConcurrencyPolicyOverridesSQL :: SchemaName -> Maybe (Maybe Int32) -> Text -> Query ()Source #

Set a concurrency policy's operator override limit. Nothing leaves it untouched. Just v writes v (a null clears the override back to the default).

lockDeadConcurrencyKeysSQL :: SchemaName -> [TableName] -> Query TextSource #

Lock count rows with no live job, in the triggers' key order. Returns the locked keys.

pruneLockedConcurrencyKeysSQL :: SchemaName -> [TableName] -> [Text] -> Query ()Source #

Delete the passed locked keys that are still dead under a fresh snapshot.

tryLockDeadConcurrencyAdvisorySQL :: [Text] -> Query TextSource #

Try an exclusive per-key advisory lock over the dead keys, pairing the insert trigger's shared lock. Never waits. Returns the keys acquired.

lockConcurrencyCountsSQL :: SchemaName -> Query TextSource #

Lock every count row in key order.

reconcileConcurrencyCountsSQL :: SchemaName -> [TableName] -> [Text] -> Query Int64Source #

Recount in_flight for the passed locked keys and seed a row for a live key that has none. Writes the rows the caller locked and fresh inserts. Run after lockConcurrencyCountsSQL in one transaction. Returns the number repaired.

concurrencyPoliciesSQL :: SchemaName -> Maybe Text -> Query ConcurrencyPolicyViewSource #

The policy views, every policy or the one a prefix names.

concurrencyPolicyExistsSQL :: SchemaName -> Text -> Query BoolSource #

Whether a concurrency policy exists for a prefix.

listConcurrencyKeysSQL :: SchemaName -> Text -> Int64 -> Int64 -> Query ConcurrencyKeyViewSource #

List a prefix's keys with effective cap and in-flight fill fraction, paginated.

concurrencyHasAnyKeySQL :: SchemaName -> Query BoolSource #

Whether any concurrency key exists.

concurrencyCountsStaleSQL :: SchemaName -> [TableName] -> Query BoolSource #

Whether a crash truncated the count table (a live keyed job has no count row).