| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.PowerQueue.Backend.LevelMem
- withLevelMem :: LevelMemCfg j -> (LevelMem j -> IO a) -> IO a
- data LevelMemCfg j = LevelMemCfg {}
- data InProgressCfg
- data JobEncoding j = JobEncoding {
- j_encode :: j -> ByteString
- j_decode :: ByteString -> Either String j
- data LevelMem j
- data JobStatus
- getJobStatusMap :: LevelMem j -> IO [(j, JobStatus)]
- getJobStatus :: Eq j => j -> LevelMem j -> IO (Maybe JobStatus)
- newLevelMemBackend :: LevelMem j -> QueueBackend j
Data container
withLevelMem :: LevelMemCfg j -> (LevelMem j -> IO a) -> IO a Source #
Create a new data container for in memory job tracking and leveldb disk persistence. Provide a FilePath for storing the data, an Int as maximum queue size and a JobEncoding for individual job encoding.
data LevelMemCfg j Source #
Constructors
| LevelMemCfg | |
Fields
| |
data InProgressCfg Source #
Behavoir for in progress jobs after loading the state from disk on launch
data JobEncoding j Source #
Binary encoding of a single job. Note that it is highly recommended to use a backwards compatible decoder, otherwise the persistent state can not be read. You could use safecopy or an appropriate cereal, binary, aeson or other decoding.
Constructors
| JobEncoding | |
Fields
| |
Constructors
| JQueued | job is enqueued, not being worked on |
| JInProgress | job currently being worked on |
getJobStatusMap :: LevelMem j -> IO [(j, JobStatus)] Source #
Get a snapshot of the current state of all jobs.
getJobStatus :: Eq j => j -> LevelMem j -> IO (Maybe JobStatus) Source #
Get the job status for a job. Note that this is a potentially expensive operation as all known jobs must be traversed. A more efficient handling would be to call getJobStatusMap once beforce launching the worker and then tracking status manually within the worker.
Actual backend for powerqueue
newLevelMemBackend :: LevelMem j -> QueueBackend j Source #
Create a queue backend from LevelMem