| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Sql.Tree
Description
Tree SQL templates.
Synopsis
- pauseChildrenSQL :: Text -> Text -> Int64 -> Query ()
- resumeChildrenSQL :: Text -> Text -> Int64 -> Query ()
- descendantsCte :: Text -> Int64 -> Query ()
- lockedByIdsCte :: Text -> [Int64] -> Query ()
- lockJobTreesSQL :: Text -> Text -> [Int64] -> Query Int64
- lockJobTreesFromRootSQL :: Text -> Text -> [Int64] -> Query Int64
- cancelJobCascadeSQL :: Text -> Text -> Int64 -> Query Int64
- forceCancelJobSQL :: SchemaName -> TableName -> Int64 -> Query Int64
- deleteCancelledJobsSQL :: SchemaName -> TableName -> Maybe UUID -> [Int64] -> Query (Int64, Maybe Int64)
- selectCancelledReapableJobsSQL :: SchemaName -> TableName -> Int -> Query Int64
- cancelJobTreeSQL :: Text -> Text -> Int64 -> Query Int64
- tryWakeAncestorSQL :: Text -> Text -> Int64 -> Query ()
- treeRollupIdsSQL :: Text -> Text -> Int64 -> Query Int64
- suspendJobSQL :: Text -> Text -> Int64 -> Query ()
- resumeJobSQL :: Text -> Text -> Int64 -> Query ()
- jobExistsSQL :: Text -> Text -> Int64 -> Query Bool
- getParentIdSQL :: Text -> Text -> Int64 -> Query (Maybe Int64)
- getParentIdsSQL :: Text -> Text -> [Int64] -> Query (Maybe Int64)
- insertResultSQL :: Text -> Text -> Int64 -> Int64 -> Value -> Query ()
- insertResultsBatchSQL :: Text -> Text -> [Int64] -> [Int64] -> [Value] -> Query ()
- getResultsByParentSQL :: Text -> Text -> Int64 -> Query (Int64, Value)
- getDLQChildErrorsByParentSQL :: Text -> Text -> Int64 -> Query (Int64, Maybe Text)
- persistParentStateSQL :: Text -> Text -> Value -> Int64 -> Query ()
- getParentStateSnapshotSQL :: Text -> Text -> Int64 -> Query (Maybe Value)
- readChildResultsSQL :: Text -> Text -> Int64 -> Query (Text, Maybe Int64, Maybe Value, Maybe Text, Maybe Int64)
Documentation
Source #pauseChildrenSQL :: Text -> Text -> Int64 -> Query ()
Suspend every claimable job in a parent's subtree. A finalizer already waiting on its own children is left as it stands. An in-flight job is left as it stands.
Source #resumeChildrenSQL :: Text -> Text -> Int64 -> Query ()
Resume the suspended jobs in a parent's subtree. A finalizer with children still in the queue stays suspended and wakes itself once they finish.
Source #descendantsCte :: Text -> Int64 -> Query ()
descendantsFromCte seeded from a job id. Shared by the cascade-delete templates.
Source #lockedByIdsCte :: Text -> [Int64] -> Query ()
CTE binding locked to the ids named, in the descending lock order of every
multi-row statement on a queue table. The statement carries
id IN (SELECT id FROM locked) to keep the CTE.
Source #lockJobTreesSQL :: Text -> Text -> [Int64] -> Query Int64
Lock the named jobs and all their descendants descending, to match ack and force-cancel. Several trees at once, their union in one pass.
Source #lockJobTreesFromRootSQL :: Text -> Text -> [Int64] -> Query Int64
Extend lockJobTreesSQL to the complete tree of each named job. This locks
all rows that tree cancellation can delete. The named identifiers also start
the downward walk. An orphan locks its subtree.
Source #cancelJobCascadeSQL :: Text -> Text -> Int64 -> Query Int64
Cancel a job and all its descendants recursively, locking descending to match ack and force-cancel.
Source #forceCancelJobSQL :: SchemaName -> TableName -> Int64 -> Query Int64
Force-cancel a job subtree. Flags still-live claimed jobs and bumps their claim token, deletes the rest, and NOTIFYs every claimed job affected.
Source #deleteCancelledJobsSQL :: SchemaName -> TableName -> Maybe UUID -> [Int64] -> Query (Int64, Maybe Int64)
Delete force-cancel-flagged jobs owner holds or no live lease holds, locking
descending to match ack and force-cancel, returning each one's parent id.
Source #selectCancelledReapableJobsSQL :: SchemaName -> TableName -> Int -> Query Int64
Flagged jobs whose lease has lapsed. The reaper deletes them and resumes their parents.
Source #cancelJobTreeSQL :: Text -> Text -> Int64 -> Query Int64
Cancel an entire job tree by walking up from any node to the root, then cascade-deleting everything from the root down, locking descending to match ack and force-cancel.
Source #tryWakeAncestorSQL :: Text -> Text -> Int64 -> Query ()
Resume a suspended parent for its completion round, once no child of it is left in the main queue.
Source #treeRollupIdsSQL :: Text -> Text -> Int64 -> Query Int64
Rollup finalizer ids in a job's tree, the job itself included. Read before a DLQ move.
Source #suspendJobSQL :: Text -> Text -> Int64 -> Query ()
Suspend a job, making it unclaimable. Refuses an in-flight job.
Source #resumeJobSQL :: Text -> Text -> Int64 -> Query ()
Resume a suspended job. Refuses a finalizer with children still in the main queue.
A child in the DLQ is terminal. The finalizer reads its error through
readChildResultsSQL and decides for itself.
Source #jobExistsSQL :: Text -> Text -> Int64 -> Query Bool
Check whether a job with the given id exists.
Source #getParentIdsSQL :: Text -> Text -> [Int64] -> Query (Maybe Int64)
Fetch the parent ids of several jobs.
Source #insertResultSQL :: Text -> Text -> Int64 -> Int64 -> Value -> Query ()
Insert a child's result into the results table.
Source #insertResultsBatchSQL :: Text -> Text -> [Int64] -> [Int64] -> [Value] -> Query ()
insertResultSQL for several children in one statement.
Source #getResultsByParentSQL :: Text -> Text -> Int64 -> Query (Int64, Value)
Get all child results for a parent from the results table.
Source #getDLQChildErrorsByParentSQL :: Text -> Text -> Int64 -> Query (Int64, Maybe Text)
Get DLQ child errors for a parent, one (job_id, last_error) row per DLQ'd child.
Source #persistParentStateSQL :: Text -> Text -> Value -> Int64 -> Query ()
Snapshot child results into parent_state before a DLQ move.