cql-io-1.1.0: Cassandra CQL client.

Safe HaskellSafe
LanguageHaskell2010

Database.CQL.IO.Jobs

Synopsis

Documentation

data Jobs k Source #

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.

Constructors

JobReplaced 

newJobs :: MonadIO m => m (Jobs k) Source #

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.

runJob_ :: (MonadIO m, Ord k) => Jobs k -> k -> IO () -> m () Source #

runJob and ignore the result.

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.

listJobs :: MonadIO m => Jobs k -> m [(k, Async ())] Source #

List all running jobs.

listJobKeys :: MonadIO m => Jobs k -> m [k] Source #

List the keys of all running jobs.