arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.Sql.Jobs

Description

Jobs SQL templates.

Synopsis

Documentation

Source #jobSortColumnName :: JobSortColumn -> Text

Underlying SQL column name for a JobSortColumn.

Source #dlqSortColumnName :: DLQSortColumn -> Text

The DLQ column a sort key names.

Source #archiveSortColumnName :: ArchiveSortColumn -> Text

The archive column a sort key names.

Source #data SortDir

Sort direction.

Constructors

SortAsc 
SortDesc 

Instances

Instances details
Eq SortDir Source # 
Instance details

Defined in Arbiter.Core.Sql.Jobs

Methods

#(==) :: SortDir -> SortDir -> Bool

#(/=) :: SortDir -> SortDir -> Bool

Bounded SortDir Source # 
Instance details

Defined in Arbiter.Core.Sql.Jobs

Enum SortDir Source # 
Instance details

Defined in Arbiter.Core.Sql.Jobs

Show SortDir Source # 
Instance details

Defined in Arbiter.Core.Sql.Jobs

Source #sortDirSql :: SortDir -> Text

A sort direction as SQL.

Source #throttledPredicateSQL :: Text

A throttle-deferred job with a live marker, still parked. Shared by status, count, and wake. Claiming clears the marker.

Source #jobStatusCaseSQL :: Text

The derived job status. Its string values match jobStatusToText.

Source #jobsWithStatusSubquery :: Text -> Text -> Text

All job columns plus the derived status column, aliased job, for filtering.

Source #listJobsFilteredSQL :: Text -> Text -> Query () -> Text -> Int64 -> Int64 -> Query (JobRead Value)

List filtered jobs without the derived status.

Source #listJobsWithStatusSQL :: Text -> Text -> Query () -> Text -> Int64 -> Int64 -> Query ()

List filtered jobs with status as a trailing column. The caller attaches the row decoder.

Source #countJobsFilteredSQL :: Text -> Text -> Query () -> Query Int64

Count filtered jobs through the status subquery.

Source #getJobByIdWithStatusSQL :: Text -> Text -> Int64 -> Query ()

Fetch a single job by id with its derived status trailing column. The caller attaches the row decoder.

Source #listDLQFilteredSQL :: Text -> Text -> Query () -> Text -> Int64 -> Int64 -> Query (Int64, UTCTime, JobRead Value)

List DLQ jobs under a dynamic WHERE and an orderBy from buildDLQOrderBy.

Source #data NullsBehavior

How NULLs in a sort column should order relative to non-NULL values.

Constructors

NullsNotApplicable

Column is NOT NULL. Emit no NULLS clause.

NullsAsAbsent

NULL means absent. Always sorts last.

NullsAsMinimum

NULL is the column's minimum (e.g. not_visible_until IS NULL means visible now). NULLS FIRST when ASC, NULLS LAST when DESC.

Source #nullsClause :: NullsBehavior -> SortDir -> Text

The NULLS placement for a column's null semantics and direction.

Source #jobColumnNulls :: JobSortColumn -> NullsBehavior

How nulls sort for a job column.

Source #dlqColumnNulls :: DLQSortColumn -> NullsBehavior

How nulls sort for a DLQ column.

Source #buildJobsOrderBy :: Maybe JobSortColumn -> Maybe SortDir -> Text

ORDER BY for the jobs table. Defaults to id DESC.

Source #buildDLQOrderBy :: Maybe DLQSortColumn -> Maybe SortDir -> Text

ORDER BY for the DLQ table. Defaults to failed_at DESC.

Source #buildArchiveOrderBy :: Maybe ArchiveSortColumn -> Maybe SortDir -> Text

ORDER BY for the archive table. Defaults to completed_at DESC.

Source #countDLQFilteredSQL :: Text -> Text -> Query () -> Query Int64

Count DLQ jobs under a dynamic WHERE.

Source #allDLQColumns :: Text

The DLQ read columns, in codec order. The DLQ uses job_id for the main-table id.

Source #jobColsExceptId :: Text

The job read columns except id. The archive INSERT copies them with the main table's id as job_id.

Source #dlqCarriedCols :: Text

Job columns carried through a DLQ round-trip. The read columns except id and last_error, plus write-only rate_limit_cost.

Source #requeuedCols :: Text

Job columns a DLQ retry carries back to the main table. The retry re-arms the rest.

Source #enqueuedAgainCols :: Text

requeuedCols for an archive re-enqueue, without the parent link.

Source #jobColumns :: Text

The job read columns, in codec order, for SELECT and RETURNING.

Source #dedupUpdateSet :: Text -> Text

DO UPDATE SET body for a replace-dedup upsert. Copies each writable column from the excluded row, then re-arms the replaced job for a fresh run.

Source #insertJobSQL :: SchemaName -> TableName -> Query () -> Query (JobRead Value)

Insert a job. The write fragment carries the column list and parameters.

Source #insertJobReplaceSQL :: SchemaName -> TableName -> Query () -> Query (JobRead Value)

Insert under the replace dedup strategy. Replaces an existing job that is idle and childless in the main queue and the DLQ. ON CONFLICT DO UPDATE fires the groups UPDATE trigger, which maintains a cross-group move.

Source #insertJobsBatchSQL :: SchemaName -> TableName -> Query () -> Query (JobRead Value)

Batch insert over unnested parallel arrays. An ignore-dedup job is skipped on conflict. A replace-dedup job updates an idle existing row.

Source #insertJobsBatchBase :: SchemaName -> TableName -> Query () -> Text -> Query ()

Batch insert with dedup and replaceable-job handling, plus a caller's RETURNING.

Source #getJobByIdSQL :: Text -> Text -> Int64 -> Query (JobRead Value)

Fetch a job by id.

Source #getJobByDedupKeySQL :: Text -> Text -> Text -> Query (JobRead Value)

Fetch a job by its dedup key. The partial unique index guarantees at most one row.

Source #cancelJobSQL :: Text -> Text -> Int64 -> Query Int64

Delete a job by id. Refuses one with children, which cancelJobCascadeSQL takes. A deleted child with no siblings left resumes its parent for a completion round.

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

UNION ALL of body over each job table, passing its raw name and schema-qualified reference.