powerqueue-0.2.0.0: A flexible job queue with exchangeable backends

Safe HaskellSafe
LanguageHaskell2010

Data.PowerQueue

Contents

Synopsis

Worker descriptions

data QueueWorker j Source #

Constructors

QueueWorker 

Fields

Instances

data JobResult Source #

Result of the job

Constructors

JOk

job is complete

JRetry

job execution should be retried

Queue control

data Queue j Source #

newQueue :: QueueBackend j -> QueueWorker j -> Queue j Source #

Create a new queue description

mapQueue :: (a -> b) -> (b -> a) -> Queue a -> Queue b Source #

enqueueJob :: j -> Queue j -> IO Bool Source #

Add a Job to the Queue

(persistent) queue backends

data QueueBackend j Source #

Constructors

Monad m => QueueBackend 

Fields

mapBackend :: (a -> b) -> (b -> a) -> QueueBackend a -> QueueBackend b Source #

basicChanBackend :: forall j. IO (QueueBackend j) Source #

A very basic in memory backend using only data structures from the base library. It should only be used for testing and serves as an implementation example

execution strategies

workStep :: Queue j -> IO () Source #

Execute a single work step: attempt a dequeue and run the job. Use to implement a queue worker, such as localQueueWorker

A local worker

localQueueWorker :: LocalWorkerConfig -> Queue j -> IO () Source #

(Concurrently) run pending jobs on local machine in current process