| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Sql.Gates
Description
Gates SQL templates.
Synopsis
- ensureGateRowSQL :: SchemaName -> Text -> Query ()
- checkGateSQL :: SchemaName -> Double -> Text -> Query Bool
- tryClaimGateSQL :: SchemaName -> Text -> Double -> Query (Maybe Value)
- claimOrReadGateSQL :: SchemaName -> Text -> Double -> Double -> Query (Maybe UTCTime, Maybe UTCTime, Maybe Value, Maybe Double)
- releaseGateSQL :: SchemaName -> Text -> UTCTime -> UTCTime -> Query ()
- gateNameDigestSQL :: Text -> Query Text
- bumpGateSQL :: SchemaName -> Text -> Query ()
- bumpGateStateSQL :: SchemaName -> Text -> Value -> Query ()
- setGateMetadataSQL :: SchemaName -> Value -> UTCTime -> Text -> Query ()
Documentation
Source #ensureGateRowSQL :: SchemaName -> Text -> Query ()
Idempotently create the gate row for a task.
Source #checkGateSQL :: SchemaName -> Double -> Text -> Query Bool
Read-only pre-transaction check. TRUE when last_run_at is older than the interval.
Source #tryClaimGateSQL :: SchemaName -> Text -> Double -> Query (Maybe Value)
Claim the gate row when the interval elapsed and no concurrent transaction holds it. Returns the state the last run left. One row back means claimed.
Source #claimOrReadGateSQL :: SchemaName -> Text -> Double -> Double -> Query (Maybe UTCTime, Maybe UTCTime, Maybe Value, Maybe Double)
Claim the gate, or read what the last winner published. NULL timestamps mean lost.
Source #releaseGateSQL :: SchemaName -> Text -> UTCTime -> UTCTime -> Query ()
Put a claim's watermark back, for a winner whose work never published. Scoped to the value that claim wrote.
Source #gateNameDigestSQL :: Text -> Query Text
An md5 digest, for a gate name too long to be a key itself.
Source #bumpGateSQL :: SchemaName -> Text -> Query ()
Bump last_run_at to NOW() inside the claim transaction.
Source #bumpGateStateSQL :: SchemaName -> Text -> Value -> Query ()
bumpGateSQL carrying the state the task resumes from, written under the claim.
Source #setGateMetadataSQL :: SchemaName -> Value -> UTCTime -> Text -> Query ()
Publish what the task computed, stamped with the claim the work started from. The gate's interval restarts from the publish.