-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A flexible job queue with exchangeable backends
--
-- A flexible job queue with exchangeable backends
@package powerqueue
@version 0.1.0.0
module Data.PowerQueue
data QueueWorker j
newQueueWorker :: (j -> IO JobResult) -> QueueWorker j
-- | Result of the job
data JobResult
-- | job is complete
JOk :: JobResult
-- | job execution should be retried
JRetry :: JobResult
data Queue j
-- | Create a new queue description
newQueue :: QueueBackend j -> QueueWorker j -> Queue j
mapQueue :: (a -> b) -> (b -> a) -> Queue a -> Queue b
-- | Add a Job to the Queue
enqueueJob :: j -> Queue j -> IO Bool
data QueueBackend j
QueueBackend :: (forall a. m a -> IO a) -> (j -> m Bool) -> m (tx, j) -> (tx -> m ()) -> (tx -> m ()) -> QueueBackend j
-- | lift an action from the backend monad into IO
[qb_lift] :: QueueBackend j -> forall a. m a -> IO a
-- | enqueue a job
[qb_enqueue] :: QueueBackend j -> j -> m Bool
-- | dequeue a single job, block if no job available
[qb_dequeue] :: QueueBackend j -> m (tx, j)
-- | mark a single job as confirmed
[qb_confirm] :: QueueBackend j -> tx -> m ()
-- | mark a single job as failed
[qb_rollback] :: QueueBackend j -> tx -> m ()
mapBackend :: (a -> b) -> (b -> a) -> QueueBackend a -> QueueBackend b
-- | 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
basicChanBackend :: forall j. IO (QueueBackend j)
-- | Execute a single work step: attempt a dequeue and run the job. Use to
-- implement a queue worker, such as localQueueWorker
workStep :: Queue j -> IO ()
data LocalWorkerConfig
LocalWorkerConfig :: !Int -> LocalWorkerConfig
[lwc_concurrentJobs] :: LocalWorkerConfig -> !Int
-- | (Concurrently) run pending jobs on local machine in current process
localQueueWorker :: LocalWorkerConfig -> Queue j -> IO ()
instance GHC.Classes.Eq Data.PowerQueue.JobResult
instance GHC.Show.Show Data.PowerQueue.JobResult
instance Data.Functor.Contravariant.Contravariant Data.PowerQueue.QueueWorker
instance Data.Functor.Contravariant.Divisible.Divisible Data.PowerQueue.QueueWorker