arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.HighLevel

Description

Job queue operations over the registry. A payload operation gets its table from the payload's registry entry.

Synopsis

Constraint aliases

type QueueOperation (m :: Type -> Type) payload = (JobPayload payload, KnownSymbol (TableForPayload payload (RegistryOf m)), MonadArbiter m)Source #

Constraints for queue operations (requires table name lookup from registry).

type JobOperation (m :: Type -> Type) payload = (JobPayload payload, MonadArbiter m)Source #

Constraints for job operations (table name stored in job).

type RegistryAdmissionPolicies (registry :: JobPayloadRegistry) = (RegistryConcurrencyPolicies registry, RegistryRateLimitPolicies registry)Source #

The constraint that lets the migration collect a registry's declared policies of both kinds.

Job operations

insertJob :: forall payload m. QueueOperation m payload => JobWrite payload -> m (Maybe (JobRead payload))Source #

Insert a job. Returns the job inserted or replaced. Nothing when an IgnoreDuplicate key already exists, or a ReplaceDuplicate key names a job that is in flight (claimed under a live lease), force-cancel-flagged, has a different parent, or has children (DLQ children count).

insertJobsBatch :: forall payload m. QueueOperation m payload => [JobWrite payload] -> m [JobRead payload]Source #

Insert multiple jobs in one round-trip. Returns the jobs inserted or replaced. An ignored duplicate is left out. Use insertJobTree for parent-child relationships.

insertJobsBatch_ :: forall payload m. QueueOperation m payload => [JobWrite payload] -> m Int64Source #

insertJobsBatch returning the rows affected, dedup replacements included.

claimNextVisibleJobs :: forall payload m. QueueOperation m payload => Int -> NominalDiffTime -> m [JobRead payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int

Maximum number of jobs to claim.

-> NominalDiffTime

How long the claimed jobs should remain invisible (in seconds).

-> m [JobRead payload] 

Claim visible jobs, at most one per group, and fewer than the limit once the groups run out. Stamps the anonymous claimant. A concurrency policy caps this path as it caps any other claim. A row whose payload fails to decode moves to the DLQ.

claimNextVisibleJobsAs :: forall payload m. QueueOperation m payload => Int -> NominalDiffTime -> UUID -> m [JobRead payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int

Maximum number of jobs to claim.

-> NominalDiffTime

How long the claimed jobs should remain invisible (in seconds).

-> UUID

Worker UUID stamped on each claimed row.

-> m [JobRead payload] 

claimNextVisibleJobs under a given worker id. A row whose payload fails to decode moves to the DLQ.

claimNextVisibleJobsBatched :: forall payload m. QueueOperation m payload => Int -> Int -> NominalDiffTime -> m [NonEmpty (JobRead payload)]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int

Batch size: maximum number of jobs to claim per group.

-> Int

Maximum number of batches to claim. Each batch is one group, or ungrouped jobs batched together.

-> NominalDiffTime

How long the claimed jobs should remain invisible (in seconds).

-> m [NonEmpty (JobRead payload)] 

claimNextVisibleJobs claiming up to batchSize jobs from each group, still in per-group order. Stamps the anonymous claimant. A row whose payload fails to decode moves to the DLQ.

ackJob :: forall payload m. MonadArbiter m => JobRead payload -> m Int64Source #

Ack a completed job, deleting it or suspending it when its children are still running. Returns 1, or 0 for a job that is gone or reclaimed.

ackJobsBatch :: forall payload m. MonadArbiter m => [JobRead payload] -> m [Int64]Source #

ackJob over a batch from one queue in one statement, returning the ids acked. Gone or reclaimed jobs are absent.

updateJobForRetry :: forall payload m. MonadArbiter m => NominalDiffTime -> Text -> JobRead payload -> m Int64Source #

Arguments

:: forall payload m. MonadArbiter m 
=> NominalDiffTime

The delay before the retry, rounded up to whole seconds.

-> Text

An error message to store with the job.

-> JobRead payload 
-> m Int64 

Park a failed job for its retry backoff. Returns 0 for a job another worker holds or a suspended job.

nackJob :: forall payload m. MonadArbiter m => JobRead payload -> m Int64Source #

Soft-nack a job. It is reprocessed once its visibility timeout lapses. No failure is recorded and no attempt is consumed. Returns 0 for a job another worker holds, a suspended job, or a released claim.

nackJobAfter :: forall payload m. MonadArbiter m => NominalDiffTime -> JobRead payload -> m Int64Source #

Arguments

:: forall payload m. MonadArbiter m 
=> NominalDiffTime

The delay before the job is visible again, rounded up to whole seconds.

-> JobRead payload 
-> m Int64 

nackJob that reprocesses the job after a delay instead of at the lease's end.

nackJobsBatch :: forall payload m. MonadArbiter m => [JobRead payload] -> m [Int64]Source #

nackJob over a batch from one queue in one statement, returning the ids nacked. Jobs another worker holds, suspended jobs and released claims are absent.

nackJobsBatchAfter :: forall payload m. MonadArbiter m => NominalDiffTime -> [JobRead payload] -> m [Int64]Source #

Arguments

:: forall payload m. MonadArbiter m 
=> NominalDiffTime

The delay before the jobs are visible again, rounded up to whole seconds.

-> [JobRead payload] 
-> m [Int64] 

nackJobsBatch that reprocesses the jobs after a delay instead of at the lease's end.

setVisibilityTimeout :: forall payload m. MonadArbiter m => NominalDiffTime -> JobRead payload -> m Int64Source #

Arguments

:: forall payload m. MonadArbiter m 
=> NominalDiffTime

The new visibility timeout (in seconds) from the current time.

-> JobRead payload 
-> m Int64 

Extend a job's visibility timeout by hand, for a long-running job. Matches the claim token only. It also extends a job the caller released (nack, retry). Returns 0 for a job that is gone, reclaimed or suspended.

setVisibilityTimeoutBatch :: forall payload m. MonadArbiter m => NominalDiffTime -> [JobRead payload] -> m [SetVisibilityResult]Source #

Arguments

:: forall payload m. MonadArbiter m 
=> NominalDiffTime

The new visibility timeout (in seconds) from the current time.

-> [JobRead payload]

Jobs to heartbeat (all must be from the same queue)

-> m [SetVisibilityResult] 

Extend the visibility timeout of a batch from one queue. Each row must still match its holder. A row whose row lock or group lock is busy is skipped.

data SetVisibilityResultSource #

Result of setting visibility timeout for a single job in a batch.

Constructors

VisibilityExtended JobId

Visibility timeout was successfully extended.

JobGone JobId

Job no longer exists (was deleted/acked).

JobReclaimed JobId ClaimSeq ClaimSeq

Job was reclaimed by another worker. Carries this claim's token, then the row's current token.

JobCancelled JobId

Job was force-cancel-flagged.

JobSuspended JobId

Job is suspended. It holds no lease.

VisibilityUnchanged JobId

Nothing was extended. The claim was released, the row or its group summary was locked, the row changed mid-statement, or another claimant holds it at the same claim token.

Rate-limit operations

addRateLimitTokens :: (MonadArbiter m, RegistryTables (RegistryOf m)) => RateLimitKey -> Double -> m Int64Source #

Add tokens to a key's bucket, clamped to [0, max], and wake any of its throttled jobs. A key without a bucket gets a full bucket and the amount has no effect. Without a policy the bucket stays unchanged and the wake still runs. Returns the number of jobs woken.

pruneRateLimitBuckets :: MonadArbiter m => NominalDiffTime -> m Int64Source #

Delete reclaimable idle (full) buckets. Returns the number pruned. The worker pool reaper runs this. A full bucket re-seeds at full on next use.

resetRateLimitBuckets :: (MonadArbiter m, RegistryTables (RegistryOf m)) => Text -> m Int64Source #

Reset every bucket for a prefix to full and wake its throttled jobs. Returns the number of buckets reset. A manual (0-refill) policy plus a cron calling this at the boundary is a fixed window.

listRateLimitPolicies :: (MonadArbiter m, RegistryTables (RegistryOf m)) => m [RateLimitPolicyView]Source #

List every rate-limit policy with its params, bucket stats, and a live count of currently-throttled jobs per prefix across the registry's queues.

getRateLimitPolicy :: (MonadArbiter m, RegistryTables (RegistryOf m)) => Text -> m (Maybe RateLimitPolicyView)Source #

One prefix's rate-limit policy with its params, bucket stats, and live throttled count. Nothing when the prefix has no policy.

rateLimitPolicyExists :: MonadArbiter m => Text -> m BoolSource #

Whether a rate-limit policy exists for a prefix.

listRateLimitBuckets :: MonadArbiter m => Text -> Int -> Int -> m [RateLimitBucketView]Source #

Arguments

:: MonadArbiter m 
=> Text

Prefix

-> Int

Limit

-> Int

Offset

-> m [RateLimitBucketView] 

List a prefix's buckets with fill levels, emptiest first.

updateRateLimitPolicyOverrides :: (MonadArbiter m, RegistryTables (RegistryOf m)) => Text -> RateLimitPolicyUpdate -> m Int64Source #

Set or clear a policy's override params and wake the prefix's throttled jobs. Returns rows affected (0 if absent).

setRateLimit :: (MonadArbiter m, RegistryTables (RegistryOf m)) => RateLimitPolicy -> m Int64Source #

Override a policy with this shape, until it is cleared. Returns rows affected.

clearRateLimit :: (MonadArbiter m, RegistryTables (RegistryOf m)) => RateLimitPolicy -> m Int64Source #

Drop a policy's overrides. Its declared params apply again. Returns rows affected.

Concurrency operations

listConcurrencyPolicies :: MonadArbiter m => m [ConcurrencyPolicyView]Source #

List every concurrency policy with its default/override limit and live key and in-flight aggregates.

getConcurrencyPolicy :: MonadArbiter m => Text -> m (Maybe ConcurrencyPolicyView)Source #

One prefix's concurrency policy with its default/override limit and live aggregates. Nothing when the prefix has no policy.

concurrencyPolicyExists :: MonadArbiter m => Text -> m BoolSource #

Whether a concurrency policy exists for a prefix.

listConcurrencyKeys :: MonadArbiter m => Text -> Int -> Int -> m [ConcurrencyKeyView]Source #

Arguments

:: MonadArbiter m 
=> Text

Prefix

-> Int

Limit

-> Int

Offset

-> m [ConcurrencyKeyView] 

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

updateConcurrencyPolicyOverrides :: MonadArbiter m => Text -> ConcurrencyPolicyUpdate -> m Int64Source #

Apply a concurrency policy's override-limit patch on its policy row, retuning every key under the prefix live. Lowering it never preempts in-flight jobs. Returns rows affected.

setConcurrencyLimit :: MonadArbiter m => ConcurrencyPolicy -> m Int64Source #

Override the policy's limit with its cpLimit, until it is cleared. Returns rows affected.

clearConcurrencyLimit :: MonadArbiter m => ConcurrencyPolicy -> m Int64Source #

Drop a concurrency policy's override. Its declared limit applies again. Returns rows affected.

pruneConcurrencyKeys :: (MonadArbiter m, RegistryTables (RegistryOf m)) => m Int64Source #

Delete drained concurrency rows with no live job. Returns the number pruned.

reconcileConcurrencyCounts :: (MonadArbiter m, RegistryTables (RegistryOf m)) => m Int64Source #

Recompute the concurrency counts from live jobs, repairing any trigger drift. Returns the rows repaired.

reconcileConcurrencyCountsIfStale :: (MonadArbiter m, RegistryTables (RegistryOf m)) => m Int64Source #

Rebuild the concurrency counts when a crash truncated the UNLOGGED table. Returns the rows repaired.

reconcileAndPruneConcurrency :: (MonadArbiter m, RegistryTables (RegistryOf m)) => m Int64Source #

Reconcile then prune. Skipped when no concurrency key exists. Returns the rows repaired plus the rows pruned.

Filtered query operations

data JobFilterSource #

A narrowing predicate on a job listing. Filters combine with AND.

Constructors

FilterGroupKey Text

Jobs in this group.

FilterParentId Int64

Children of this parent.

FilterRootsOnly

Jobs with no parent.

FilterStatus JobStatus

Jobs with this derived status. Matches nothing on the DLQ or archive.

FilterId Int64

The row with this primary key.

FilterJobId Int64

The row with this original job id. On the main table, the row with this id.

FilterClaimedBy UUID

Jobs claimed by this worker.

FilterKind Text

Jobs with this kind label.

FilterPayloadText Text

Jobs whose payload text holds this substring, ignoring case.

FilterErrorText Text

Jobs whose last error holds this substring, ignoring case.

FilterRateLimitPrefix Text

Jobs under this rate-limit prefix.

FilterConcurrencyPrefix Text

Jobs under this concurrency prefix.

FilterInsertedAfter UTCTime

Jobs inserted at or after this time.

FilterInsertedBefore UTCTime

Jobs inserted before this time.

FilterCompletedAfter UTCTime

Jobs completed at or after this time. Matches nothing outside the archive.

FilterCompletedBefore UTCTime

Jobs completed before this time. Matches nothing outside the archive.

Instances

Instances details
Eq JobFilter Source # 
Instance details

Defined in Arbiter.Core.Sql.Jobs

Show JobFilter Source # 
Instance details

Defined in Arbiter.Core.Sql.Jobs

data DLQSortColumnSource #

Sortable columns on the DLQ table. DlqId is the DLQ primary key and DlqJobId the original job id.

Constructors

DlqId

By id, the DLQ primary key.

DlqFailedAt

By failed_at.

DlqJobId

By job_id, the original job id.

DlqPriority

By priority.

DlqAttempts

By attempts.

DlqInsertedAt

By inserted_at.

DlqGroupKey

By group_key.

DlqParentId

By parent_id.

DlqLastAttemptedAt

By last_attempted_at.

data ArchiveSortColumnSource #

Sortable columns on the archive table. ArchiveId is the archive primary key and ArchiveJobId the original job id.

Constructors

ArchiveId

By id, the archive primary key.

ArchiveCompletedAt

By completed_at.

ArchiveInsertedAt

By inserted_at.

ArchiveJobId

By job_id, the original job id.

ArchiveAttempts

By attempts.

ArchiveGroupKey

By group_key.

ArchiveParentId

By parent_id.

data SortDirSource #

Sort direction.

Constructors

SortAsc

Ascending.

SortDesc

Descending.

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

listJobsFiltered :: forall payload m. QueueOperation m payload => [JobFilter] -> Int -> Int -> m [JobRead payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [JobFilter]

Composable filters

-> Int

Limit

-> Int

Offset

-> m [JobRead payload] 

List filtered jobs, newest first.

countJobsFiltered :: forall payload m. QueueOperation m payload => [JobFilter] -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [JobFilter]

Composable filters

-> m Int64 

Count filtered jobs.

listDLQFiltered :: forall payload m. QueueOperation m payload => [JobFilter] -> Int -> Int -> m [DLQJob payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [JobFilter]

Composable filters

-> Int

Limit

-> Int

Offset

-> m [DLQJob payload] 

List filtered DLQ jobs, most recently failed first.

countDLQFiltered :: forall payload m. QueueOperation m payload => [JobFilter] -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [JobFilter]

Composable filters

-> m Int64 

Count filtered DLQ jobs.

listArchiveFiltered :: forall payload m. QueueOperation m payload => [JobFilter] -> Int -> Int -> m [ArchiveJob payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [JobFilter]

Composable filters

-> Int

Limit

-> Int

Offset

-> m [ArchiveJob payload] 

List filtered archived jobs, most recently completed first.

countArchiveFiltered :: forall payload m. QueueOperation m payload => [JobFilter] -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [JobFilter]

Composable filters

-> m Int64 

Count filtered archived jobs.

Dead-letter queue operations

moveToDLQ :: forall payload m. MonadArbiter m => Text -> JobRead payload -> m Int64Source #

Arguments

:: forall payload m. MonadArbiter m 
=> Text

Error message (the final error that caused the DLQ move)

-> JobRead payload 
-> m Int64 

Move a job to the DLQ. Returns 0 for a job another worker holds.

moveToDLQBatch :: forall payload m. MonadArbiter m => [(JobRead payload, Text)] -> m Int64Source #

Arguments

:: forall payload m. MonadArbiter m 
=> [(JobRead payload, Text)]

List of (job, error message) pairs. All jobs must be from the same queue.

-> m Int64 

Move a batch of jobs to the DLQ, skipping any another worker holds. Returns the number moved.

listDLQJobs :: forall payload m. QueueOperation m payload => Int -> Int -> m [DLQJob payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int

Limit

-> Int

Offset

-> m [DLQJob payload] 

List DLQ jobs, most recently failed first.

retryFromDLQ :: forall payload m. QueueOperation m payload => Int64 -> m (Maybe (JobRead payload))Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

DLQ primary key (dlqPrimaryKey)

-> m (Maybe (JobRead payload)) 

Retry the whole DLQ tree that holds a DLQ row, with a fresh attempt count. The dedup key is left behind. Returns the restored job for that row. Nothing when the row is gone or the root's parent no longer exists.

retryFromDLQWithPayload :: forall payload m. QueueOperation m payload => Int64 -> payload -> m (Maybe (JobRead payload))Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

DLQ primary key (dlqPrimaryKey)

-> payload 
-> m (Maybe (JobRead payload)) 

retryFromDLQ with a replacement payload. The columns the payload derives are derived again from it.

retryFromDLQBatch :: forall payload m. QueueOperation m payload => [Int64] -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [Int64]

DLQ primary keys (dlqPrimaryKey)

-> m Int64 

retryFromDLQ over several DLQ rows, each tree in its own transaction. A row restored with an earlier row's tree is skipped. Returns the number of rows whose retry restored a tree.

retryDLQFiltered :: forall payload m. QueueOperation m payload => [JobFilter] -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [JobFilter]

Composable filters

-> m Int64 

retryFromDLQBatch over every DLQ row the filters match when it starts, oldest first. No filters retries the whole DLQ.

dlqJobExists :: forall payload m. QueueOperation m payload => Int64 -> m BoolSource #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

DLQ primary key (dlqPrimaryKey)

-> m Bool 

Whether a DLQ row with the given DLQ primary key exists.

deleteDLQJob :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

DLQ primary key (dlqPrimaryKey)

-> m Int64 

Delete a DLQ job. Returns 0 when the row is already gone.

deleteDLQJobsBatch :: forall payload m. QueueOperation m payload => [Int64] -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [Int64]

DLQ primary keys (dlqPrimaryKey)

-> m Int64 

Delete DLQ jobs by DLQ primary key. Returns the number deleted.

Archive operations

listArchiveJobs :: forall payload m. QueueOperation m payload => Int -> Int -> m [ArchiveJob payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int

Limit

-> Int

Offset

-> m [ArchiveJob payload] 

List archived jobs, most recently completed first.

getArchiveJobById :: forall payload m. QueueOperation m payload => Int64 -> m (Maybe (ArchiveJob payload))Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Original job id

-> m (Maybe (ArchiveJob payload)) 

Fetch a single archived job by its original job id.

listArchiveJobsByGroup :: forall payload m. QueueOperation m payload => Text -> Int -> Int -> m [ArchiveJob payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Text

Group key

-> Int

Limit

-> Int

Offset

-> m [ArchiveJob payload] 

List archived jobs in a group, most recently completed first, with pagination.

deleteArchiveJob :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Archive primary key

-> m Int64 

Delete one archived job by its archive primary key. Returns rows deleted.

deleteArchiveJobsBatch :: forall payload m. QueueOperation m payload => [Int64] -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [Int64]

Archive primary keys

-> m Int64 

Delete archived jobs by archive primary key. Returns rows deleted.

reEnqueueFromArchive :: forall payload m. QueueOperation m payload => Int64 -> m (Maybe (JobRead payload))Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Archive primary key

-> m (Maybe (JobRead payload)) 

Re-enqueue an archived job as a fresh standalone job, keeping the archive row. Returns the new job, or Nothing if the archive row no longer exists.

reEnqueueFromArchiveWithPayload :: forall payload m. QueueOperation m payload => Int64 -> payload -> m (Maybe (JobRead payload))Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Archive primary key

-> payload 
-> m (Maybe (JobRead payload)) 

reEnqueueFromArchive with a replacement payload. The columns the payload derives are derived again from it.

Admin operations

listJobs :: forall payload m. QueueOperation m payload => Int -> Int -> m [JobRead payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int

Limit

-> Int

Offset

-> m [JobRead payload] 

List jobs, newest first.

getJobById :: forall payload m. QueueOperation m payload => Int64 -> m (Maybe (JobRead payload))Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> m (Maybe (JobRead payload)) 

Fetch a job by id.

jobExists :: forall payload m. QueueOperation m payload => Int64 -> m BoolSource #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> m Bool 

Whether a job with the given id exists in this payload's queue table.

listJobsByGroup :: forall payload m. QueueOperation m payload => Text -> Int -> Int -> m [JobRead payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Text

Group key

-> Int

Limit

-> Int

Offset

-> m [JobRead payload] 

A page of a group's jobs, newest first.

listJobsByParent :: forall payload m. QueueOperation m payload => Int64 -> Int -> Int -> m [JobRead payload]Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent id

-> Int

Limit

-> Int

Offset

-> m [JobRead payload] 

List a parent's children, newest first.

cancelJob :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> m Int64 

Delete a job by id. Returns 0 for a job with children. cancelJobCascade deletes those.

cancelJobsBatch :: forall payload m. QueueOperation m payload => [Int64] -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [Int64]

Job ids

-> m Int64 

Delete jobs by id. A job with children is skipped. Returns the number deleted.

forceCancelJob :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Root job id

-> m Int64 

Cascade-cancel a job subtree. Flags still-live claimed jobs, deletes the rest, and NOTIFYs the queue's cancel channel for every claimed job affected. Returns the number flagged or deleted.

promoteJob :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> m Int64 

Make a delayed or retrying job immediately visible. Refuses an in-flight or suspended job.

rescheduleJob :: forall payload m. QueueOperation m payload => Int64 -> UTCTime -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> UTCTime

When the job becomes visible

-> m Int64 

Set when a job next becomes visible. Refuses an in-flight, suspended, force-cancel-flagged or exhausted job.

data QueueStatsSource #

Per-status breakdown of a queue. The per-status counts partition the queue and sum to totalJobs.

Constructors

QueueStats 

Fields

Instances

Instances details
FromJSON QueueStats Source # 
Instance details

Defined in Arbiter.Core.Operations

ToJSON QueueStats Source # 
Instance details

Defined in Arbiter.Core.Operations

Eq QueueStats Source # 
Instance details

Defined in Arbiter.Core.Operations

Generic QueueStats Source # 
Instance details

Defined in Arbiter.Core.Operations

Associated Types

type Rep QueueStats 
Instance details

Defined in Arbiter.Core.Operations

type Rep QueueStats = D1 ('MetaData "QueueStats" "Arbiter.Core.Operations" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "QueueStats" 'PrefixI 'True) (((S1 ('MetaSel ('Just "totalJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: (S1 ('MetaSel ('Just "readyJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "inFlightJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64))) :*: ((S1 ('MetaSel ('Just "scheduledJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "backoffJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :*: (S1 ('MetaSel ('Just "throttledJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "suspendedJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)))) :*: (((S1 ('MetaSel ('Just "cancelledJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "exhaustedJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :*: (S1 ('MetaSel ('Just "blockedJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "oldestReadyAgeSeconds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Double)))) :*: ((S1 ('MetaSel ('Just "oldestInFlightAgeSeconds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Double)) :*: S1 ('MetaSel ('Just "dlqJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :*: (S1 ('MetaSel ('Just "kindCounts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Int64)) :*: S1 ('MetaSel ('Just "dlqKindCounts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Int64)))))))
Show QueueStats Source # 
Instance details

Defined in Arbiter.Core.Operations

type Rep QueueStats Source # 
Instance details

Defined in Arbiter.Core.Operations

type Rep QueueStats = D1 ('MetaData "QueueStats" "Arbiter.Core.Operations" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "QueueStats" 'PrefixI 'True) (((S1 ('MetaSel ('Just "totalJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: (S1 ('MetaSel ('Just "readyJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "inFlightJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64))) :*: ((S1 ('MetaSel ('Just "scheduledJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "backoffJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :*: (S1 ('MetaSel ('Just "throttledJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "suspendedJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)))) :*: (((S1 ('MetaSel ('Just "cancelledJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "exhaustedJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :*: (S1 ('MetaSel ('Just "blockedJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "oldestReadyAgeSeconds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Double)))) :*: ((S1 ('MetaSel ('Just "oldestInFlightAgeSeconds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Double)) :*: S1 ('MetaSel ('Just "dlqJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :*: (S1 ('MetaSel ('Just "kindCounts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Int64)) :*: S1 ('MetaSel ('Just "dlqKindCounts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Int64)))))))

data QueueOverviewSource #

A landing-overview row: a queue's stats, pause flag and worker counts.

Constructors

QueueOverview 

Fields

Instances

Instances details
FromJSON QueueOverview Source # 
Instance details

Defined in Arbiter.Core.Operations

ToJSON QueueOverview Source # 
Instance details

Defined in Arbiter.Core.Operations

Eq QueueOverview Source # 
Instance details

Defined in Arbiter.Core.Operations

Generic QueueOverview Source # 
Instance details

Defined in Arbiter.Core.Operations

Associated Types

type Rep QueueOverview 
Instance details

Defined in Arbiter.Core.Operations

type Rep QueueOverview = D1 ('MetaData "QueueOverview" "Arbiter.Core.Operations" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "QueueOverview" 'PrefixI 'True) ((S1 ('MetaSel ('Just "overviewQueue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "overviewStats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QueueStats)) :*: (S1 ('MetaSel ('Just "overviewQueuePaused") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "overviewWorkersLive") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "overviewWorkersPaused") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)))))
Show QueueOverview Source # 
Instance details

Defined in Arbiter.Core.Operations

type Rep QueueOverview Source # 
Instance details

Defined in Arbiter.Core.Operations

type Rep QueueOverview = D1 ('MetaData "QueueOverview" "Arbiter.Core.Operations" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "QueueOverview" 'PrefixI 'True) ((S1 ('MetaSel ('Just "overviewQueue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "overviewStats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QueueStats)) :*: (S1 ('MetaSel ('Just "overviewQueuePaused") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "overviewWorkersLive") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Just "overviewWorkersPaused") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)))))

data GroupSummarySource #

One open group, read from the queue's groups summary.

Constructors

GroupSummary 

Fields

getQueueStats :: forall payload m. QueueOperation m payload => m QueueStatsSource #

A queue's per-status counts and backlog ages.

Count operations

countJobs :: forall payload m. QueueOperation m payload => m Int64Source #

Count every job in the queue.

countJobsByGroup :: forall payload m. QueueOperation m payload => Text -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Text

Group key

-> m Int64 

Count a group's jobs.

countJobsByParent :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent id

-> m Int64 

Count a parent's children.

countDLQJobs :: forall payload m. QueueOperation m payload => m Int64Source #

Count the queue's DLQ jobs.

countChildrenBatch :: forall payload m. QueueOperation m payload => [Int64] -> m (Map Int64 (Int64, Int64))Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [Int64]

Parent job ids

-> m (Map Int64 (Int64, Int64)) 

Child counts as (total, suspended) per parent id, over a batch. Parents with none are absent.

countDLQChildren :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent job id

-> m Int64 

Count a parent's children in the DLQ.

countDLQChildrenBatch :: forall payload m. QueueOperation m payload => [Int64] -> m (Map Int64 Int64)Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> [Int64]

Parent job ids

-> m (Map Int64 Int64) 

DLQ child counts per parent id, over a batch. Parents with none are absent.

Job dependency operations

pauseChildren :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent job id

-> m Int64 

Suspend every unsuspended visible job in a parent's subtree, lapsed leases included. Jobs with a future visibility (delayed, backoff, throttled, leased) are skipped. Returns the number suspended.

resumeChildren :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent job id

-> m Int64 

Resume the suspended jobs in a parent's subtree. A finalizer with children still in the queue stays suspended. Returns the number resumed.

cancelJobCascade :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Root job id

-> m Int64 

Delete a job and every descendant under it. Returns the number deleted.

Suspend and resume operations

suspendJob :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> m Int64 

Suspend a job, making it unclaimable. Refuses an in-flight job.

resumeJob :: forall payload m. QueueOperation m payload => Int64 -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> m Int64 

Resume a suspended job. Refuses a finalizer with children still in the main queue.

Child results and parent state

insertResult :: forall payload m. (EncodeJobResult (ResultOf m payload), QueueOperation m payload) => Int64 -> Int64 -> ResultOf m payload -> m Int64Source #

Arguments

:: forall payload m. (EncodeJobResult (ResultOf m payload), QueueOperation m payload) 
=> Int64

Parent job id

-> Int64

Child job id

-> ResultOf m payload

Result value

-> m Int64 

Upsert a child's result, encoded as the queue's declared result type and keyed by (parent_id, child_id). A second write replaces the first. Its foreign key cascades. Acking the parent clears it. Returns 0 for a result that stores nothing.

insertResultUnsafe :: forall payload m. QueueOperation m payload => Int64 -> Int64 -> Value -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent job id

-> Int64

Child job id

-> Value

Encoded result value

-> m Int64 

insertResult with a raw JSON value, as an upsert, bypassing the queue's declared result type. A value Arbiter.Worker.childResults cannot decode surfaces there as a Left.

getResultsByParent :: forall payload m. QueueOperation m payload => Int64 -> m (Map Int64 Value)Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent job id

-> m (Map Int64 Value) 

A parent's child results, keyed by child id.

getDLQChildErrorsByParent :: forall payload m. QueueOperation m payload => Int64 -> m (Map Int64 Text)Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent job id

-> m (Map Int64 Text) 

The last errors of a parent's children in the DLQ, keyed by child id. Children with no recorded error are left out.

readChildResultsRaw :: forall payload m. QueueOperation m payload => Int64 -> m (Map Int64 Value, Map Int64 Text, Maybe Value, Map Int64 Text)Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Parent job id

-> m (Map Int64 Value, Map Int64 Text, Maybe Value, Map Int64 Text) 

Read all child data for a rollup finalizer. Returns (childId->result, childId->error, parentStateSnapshot, dlqRowId->error).

mergeRawChildResults :: Map Int64 Value -> Map Int64 Text -> Maybe Value -> Map Int64 (Either Text Value)Source #

Merge DLQ errors, child results and the snapshot, left-biased in that order.

persistParentState :: forall payload m. QueueOperation m payload => Int64 -> Value -> m Int64Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> Value

Snapshot to store

-> m Int64 

Snapshot results into parent_state before DLQ move.

getParentStateSnapshot :: forall payload m. QueueOperation m payload => Int64 -> m (Maybe Value)Source #

Arguments

:: forall payload m. QueueOperation m payload 
=> Int64

Job id

-> m (Maybe Value) 

Read raw parent_state snapshot from the DB.

Groups table operations

refreshAllGroupsFully :: (MonadArbiter m, RegistryTables (RegistryOf m)) => m (Int64, [Text])Source #

Refresh every registered queue's groups table to the end. Returns the rows rewritten and the queue names that failed.

Worker registry operations

registerWorker :: MonadArbiter m => UUID -> Text -> Maybe Text -> Maybe Int32 -> NominalDiffTime -> Maybe Value -> m (Maybe Bool)Source #

Arguments

:: MonadArbiter m 
=> UUID

Worker id

-> Text

Queue name

-> Maybe Text

Host name

-> Maybe Int32

Worker thread count

-> NominalDiffTime

Heartbeat age after which the worker counts as stale

-> Maybe Value

Free-form metadata

-> m (Maybe Bool) 

Register or refresh a worker and return its effective pause state (worker or queue). Nothing when the upsert returns no row.

heartbeatWorker :: MonadArbiter m => UUID -> m (Maybe Bool)Source #

Record a heartbeat and return the worker's effective pause state (worker or queue). Nothing when the worker has no registry row.

setWorkerPaused :: MonadArbiter m => UUID -> Bool -> m Int64Source #

Set a worker's pause flag and notify the worker.

markWorkerShuttingDown :: MonadArbiter m => UUID -> m Int64Source #

Mark a worker as gracefully draining.

deregisterWorker :: MonadArbiter m => UUID -> m Int64Source #

Remove a worker registry row.

listWorkers :: MonadArbiter m => Maybe Text -> Maybe NominalDiffTime -> m [WorkerRow]Source #

List workers, optionally filtered by queue and heartbeat age.

sweepStaleWorkers :: MonadArbiter m => m Int64Source #

Delete workers whose last heartbeat is older than their stale threshold.

data WorkerRowSource #

A row in the worker registry. One row per running worker.

Constructors

WorkerRow 

Fields

Instances

Instances details
FromJSON WorkerRow Source # 
Instance details

Defined in Arbiter.Core.Worker

ToJSON WorkerRow Source # 
Instance details

Defined in Arbiter.Core.Worker

Eq WorkerRow Source # 
Instance details

Defined in Arbiter.Core.Worker

Generic WorkerRow Source # 
Instance details

Defined in Arbiter.Core.Worker

Show WorkerRow Source # 
Instance details

Defined in Arbiter.Core.Worker

type Rep WorkerRow Source # 
Instance details

Defined in Arbiter.Core.Worker

data WorkerHealthSource #

Heartbeat-derived health of a worker. Independent of its paused flag.

Constructors

Live

The heartbeat is fresh and the worker is not shutting down.

Stale

The last heartbeat is older than the worker's stale threshold.

Draining

The heartbeat is fresh and the worker is shutting down.

Instances

Instances details
FromJSON WorkerHealth Source # 
Instance details

Defined in Arbiter.Core.Worker

ToJSON WorkerHealth Source # 
Instance details

Defined in Arbiter.Core.Worker

Eq WorkerHealth Source # 
Instance details

Defined in Arbiter.Core.Worker

Bounded WorkerHealth Source # 
Instance details

Defined in Arbiter.Core.Worker

Enum WorkerHealth Source # 
Instance details

Defined in Arbiter.Core.Worker

Generic WorkerHealth Source # 
Instance details

Defined in Arbiter.Core.Worker

Associated Types

type Rep WorkerHealth 
Instance details

Defined in Arbiter.Core.Worker

type Rep WorkerHealth = D1 ('MetaData "WorkerHealth" "Arbiter.Core.Worker" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Live" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Stale" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Draining" 'PrefixI 'False) (U1 :: Type -> Type)))
Show WorkerHealth Source # 
Instance details

Defined in Arbiter.Core.Worker

type Rep WorkerHealth Source # 
Instance details

Defined in Arbiter.Core.Worker

type Rep WorkerHealth = D1 ('MetaData "WorkerHealth" "Arbiter.Core.Worker" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Live" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Stale" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Draining" 'PrefixI 'False) (U1 :: Type -> Type)))

Queue operations

ensureQueue :: MonadArbiter m => Text -> m Int64Source #

Ensure a queue's row exists.

setQueuePaused :: MonadArbiter m => Text -> Bool -> m Int64Source #

Set a queue's pause flag and notify its workers.

setQueueDLQRetention :: MonadArbiter m => Text -> Maybe NominalDiffTime -> m ()Source #

Set the age in seconds at which the reaper purges the queue's DLQ jobs, creating the queue's row if missing. Nothing keeps them. The retention must be positive. Every pool and server sharing the schema applies it.

getQueue :: MonadArbiter m => Text -> m (Maybe QueueRow)Source #

Get one queue's row.

listQueues :: MonadArbiter m => m [QueueRow]Source #

List the queue rows, ordered by queue name.

data QueueRowSource #

A row of the arbiter_queues table.

Constructors

QueueRow 

Fields

Instances

Instances details
FromJSON QueueRow Source # 
Instance details

Defined in Arbiter.Core.Queues

ToJSON QueueRow Source # 
Instance details

Defined in Arbiter.Core.Queues

Eq QueueRow Source # 
Instance details

Defined in Arbiter.Core.Queues

Generic QueueRow Source # 
Instance details

Defined in Arbiter.Core.Queues

Show QueueRow Source # 
Instance details

Defined in Arbiter.Core.Queues

type Rep QueueRow Source # 
Instance details

Defined in Arbiter.Core.Queues

Cron schedule operations

listCronSchedules :: MonadArbiter m => Maybe Text -> m [CronScheduleRow]Source #

Arguments

:: MonadArbiter m 
=> Maybe Text

Queue filter. Nothing returns schedules for all queues.

-> m [CronScheduleRow] 

List cron schedules ordered by name, optionally filtered by queue.

getCronScheduleByName :: MonadArbiter m => Text -> m (Maybe CronScheduleRow)Source #

Arguments

:: MonadArbiter m 
=> Text

Schedule name

-> m (Maybe CronScheduleRow) 

Get a single cron schedule by name.

updateCronScheduleUnchecked :: MonadArbiter m => Text -> CronScheduleUpdate -> m Int64Source #

Arguments

:: MonadArbiter m 
=> Text

Schedule name

-> CronScheduleUpdate 
-> m Int64 

Patch a cron schedule, writing the overrides as given. Returns rows affected, 0 for a name that is not there or an empty patch. Arbiter.Worker.updateCronScheduleChecked rejects overrides the scheduler cannot parse.

data CronScheduleRowSource #

A row from the cron_schedules table.

Constructors

CronScheduleRow 

Fields

Instances

Instances details
FromJSON CronScheduleRow Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

ToJSON CronScheduleRow Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

Eq CronScheduleRow Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

Generic CronScheduleRow Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

Associated Types

type Rep CronScheduleRow 
Instance details

Defined in Arbiter.Core.CronSchedule

type Rep CronScheduleRow = D1 ('MetaData "CronScheduleRow" "Arbiter.Core.CronSchedule" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "CronScheduleRow" 'PrefixI 'True) (((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "queueName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "defaultExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) :*: ((S1 ('MetaSel ('Just "defaultOverlap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "defaultTimezone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "overrideExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "overrideOverlap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))))) :*: (((S1 ('MetaSel ('Just "overrideTimezone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "enabled") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "lastFiredAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime)) :*: S1 ('MetaSel ('Just "lastCheckedAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime)))) :*: ((S1 ('MetaSel ('Just "runRequestedAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime)) :*: S1 ('MetaSel ('Just "lastManualRunAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime))) :*: (S1 ('MetaSel ('Just "createdAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "updatedAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime))))))
Show CronScheduleRow Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

type Rep CronScheduleRow Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

type Rep CronScheduleRow = D1 ('MetaData "CronScheduleRow" "Arbiter.Core.CronSchedule" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "CronScheduleRow" 'PrefixI 'True) (((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "queueName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "defaultExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) :*: ((S1 ('MetaSel ('Just "defaultOverlap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "defaultTimezone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "overrideExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "overrideOverlap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))))) :*: (((S1 ('MetaSel ('Just "overrideTimezone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "enabled") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "lastFiredAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime)) :*: S1 ('MetaSel ('Just "lastCheckedAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime)))) :*: ((S1 ('MetaSel ('Just "runRequestedAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime)) :*: S1 ('MetaSel ('Just "lastManualRunAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime))) :*: (S1 ('MetaSel ('Just "createdAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "updatedAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime))))))

data CronScheduleUpdateSource #

A patch over a cron schedule's overrides. Nothing leaves a field unchanged, Just Nothing clears the override back to the default, Just (Just v) sets it.

Constructors

CronScheduleUpdate 

Fields

Instances

Instances details
FromJSON CronScheduleUpdate Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

ToJSON CronScheduleUpdate Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

Eq CronScheduleUpdate Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

Generic CronScheduleUpdate Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

Associated Types

type Rep CronScheduleUpdate 
Instance details

Defined in Arbiter.Core.CronSchedule

type Rep CronScheduleUpdate = D1 ('MetaData "CronScheduleUpdate" "Arbiter.Core.CronSchedule" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "CronScheduleUpdate" 'PrefixI 'True) ((S1 ('MetaSel ('Just "overrideExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Maybe Text))) :*: S1 ('MetaSel ('Just "overrideOverlap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Maybe Text)))) :*: (S1 ('MetaSel ('Just "overrideTimezone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Maybe Text))) :*: S1 ('MetaSel ('Just "enabled") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)))))
Show CronScheduleUpdate Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

type Rep CronScheduleUpdate Source # 
Instance details

Defined in Arbiter.Core.CronSchedule

type Rep CronScheduleUpdate = D1 ('MetaData "CronScheduleUpdate" "Arbiter.Core.CronSchedule" "arbiter-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "CronScheduleUpdate" 'PrefixI 'True) ((S1 ('MetaSel ('Just "overrideExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Maybe Text))) :*: S1 ('MetaSel ('Just "overrideOverlap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Maybe Text)))) :*: (S1 ('MetaSel ('Just "overrideTimezone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Maybe Text))) :*: S1 ('MetaSel ('Just "enabled") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)))))

Global gate

runGated :: MonadArbiter m => Text -> NominalDiffTime -> m a -> m (Maybe a)Source #

Arguments

:: MonadArbiter m 
=> Text

Task identifier

-> NominalDiffTime

Minimum interval between runs, in seconds.

-> m a 
-> m (Maybe a) 

Run work at most once per interval across every worker pool sharing the same schema. Nothing when the gate ran too recently or another pool holds the task.

Job tree DSL

insertJobTree :: forall payload m. QueueOperation m payload => JobTree payload -> m (Either Text (NonEmpty (JobRead payload)))Source #

Insert a JobTree atomically. Returns all inserted jobs in pre-order. Left on a dedup conflict at any node, with nothing committed.

spawnChildren :: forall payload m. JobOperation m payload => JobRead payload -> NonEmpty (JobWrite payload) -> m (NonEmpty (JobRead payload))Source #

Insert children under a claimed job, making it a rollup finalizer. Ack it in the same transaction. Throws JobGoneException when the claim is gone, and JobScopedFailure with Retryable on a dedup conflict or a second spawn in the same round.

Table lookup

queueTable :: forall payload (m :: Type -> Type). KnownSymbol (TableForPayload payload (RegistryOf m)) => TextSource #

The table name payload's entry in this monad's registry declares.

Re-exports

getSchema :: MonadArbiter m => m SchemaNameSource #

The schema name for this monad's arbiter tables.