Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- data Jobs k
- data JobReplaced = JobReplaced
- newJobs :: MonadIO m => m (Jobs k)
- runJob :: (MonadIO m, Ord k) => Jobs k -> k -> IO () -> m (Async ())
- runJob_ :: (MonadIO m, Ord k) => Jobs k -> k -> IO () -> m ()
- tryRunJob :: (MonadIO m, Ord k) => Jobs k -> k -> IO () -> m (Maybe (Async ()))
- tryRunJob_ :: (MonadIO m, Ord k) => Jobs k -> k -> IO () -> m ()
- cancelJobs :: MonadIO m => Jobs k -> m ()
- listJobs :: MonadIO m => Jobs k -> m [(k, Async ())]
- listJobKeys :: MonadIO m => Jobs k -> m [k]
Documentation
A registry for asynchronous computations ("jobs") associated with keys
of type k
, with only a single job running at a time for a particular key.
data JobReplaced Source #
The asynchronous exception used to cancel a job if it is replaced by another job.
Instances
Eq JobReplaced Source # | |
Defined in Database.CQL.IO.Jobs (==) :: JobReplaced -> JobReplaced -> Bool # (/=) :: JobReplaced -> JobReplaced -> Bool # | |
Show JobReplaced Source # | |
Defined in Database.CQL.IO.Jobs showsPrec :: Int -> JobReplaced -> ShowS # show :: JobReplaced -> String # showList :: [JobReplaced] -> ShowS # | |
Exception JobReplaced Source # | |
Defined in Database.CQL.IO.Jobs |
runJob :: (MonadIO m, Ord k) => Jobs k -> k -> IO () -> m (Async ()) Source #
Run an asynchronous job for a key. If there is a running job for the same
key, it is replaced and cancelled with a JobReplaced
exception.
tryRunJob :: (MonadIO m, Ord k) => Jobs k -> k -> IO () -> m (Maybe (Async ())) Source #
Try to run an asynchronous job for a key. If there is a running job for
the same key, Nothing
is returned and the job will not run.
tryRunJob_ :: (MonadIO m, Ord k) => Jobs k -> k -> IO () -> m () Source #
tryRunJob
and ignore the result.
cancelJobs :: MonadIO m => Jobs k -> m () Source #
Cancel all running jobs.
listJobKeys :: MonadIO m => Jobs k -> m [k] Source #
List the keys of all running jobs.