Workflow-0.5.8.0: library for transparent execution of interruptible computations

Data.Persistent.Queue.Binary

Description

This module implements a persistent, transactional collection with Queue interface as well as indexed access by key This module uses Data.Binary for serialization.

Here QueueConstraints w r a means Data.Binary.Binary a

For optimal (de)serialization if you store in the queue different versions of largue structures , for example, documents you better use Data.RefSerialize and Data.Persistent.Queue.Text Instead.

Synopsis

Documentation

type RefQueue a = DBRef (Queue a)Source

a queue reference

getQRef :: (Typeable a, QueueConstraints w r a) => String -> RefQueue aSource

get the reference to new or existing queue trough its name

popSource

Arguments

:: (Typeable a, QueueConstraints w r a) 
=> RefQueue a

Queue name

-> IO a

the returned elems

read the first element in the queue and delete it (pop)

popSTM :: (Typeable a, QueueConstraints w r a) => RefQueue a -> STM aSource

version in the STM monad

pickSource

Arguments

:: (Typeable a, QueueConstraints w r a) 
=> RefQueue a

Queue name

-> IO a

the returned elems

flush :: (Typeable a, QueueConstraints w r a) => RefQueue a -> IO ()Source

empty the queue (factually, it is deleted)

flushSTM :: (Typeable a, QueueConstraints w r a) => RefQueue a -> STM ()Source

version in the STM monad

pickAll :: (Typeable a, QueueConstraints w r a) => RefQueue a -> IO [a]Source

return the list of all elements in the queue. The queue remains unchanged

pickAllSTM :: (Typeable a, QueueConstraints w r a) => RefQueue a -> STM [a]Source

version in the STM monad

push :: (Typeable a, QueueConstraints w r a) => RefQueue a -> a -> IO ()Source

push an element in the queue

pushSTM :: (Typeable a, QueueConstraints w r a) => RefQueue a -> a -> STM ()Source

version in the STM monad

pickElem :: (Indexable a, Typeable a, QueueConstraints w r a) => RefQueue a -> String -> IO (Maybe a)Source

return the first element in the queue that has the given key

pickElemSTM :: (Indexable a, Typeable a, QueueConstraints w r a) => RefQueue a -> String -> STM (Maybe a)Source

version in the STM monad

readAll :: (Typeable a, QueueConstraints w r a) => RefQueue a -> IO [a]Source

return the list of all elements in the queue and empty it

readAllSTM :: (Typeable a, QueueConstraints w r a) => RefQueue a -> STM [a]Source

a version in the STM monad

deleteElem :: (Indexable a, Typeable a, QueueConstraints w r a) => RefQueue a -> a -> IO ()Source

delete all the elements of the queue that has the key of the parameter passed

deleteElemSTM :: (Typeable a, Indexable a, QueueConstraints w r a) => RefQueue a -> a -> STM ()Source

verison in the STM monad

unreadSTM :: (Typeable a, QueueConstraints w r a) => RefQueue a -> a -> STM ()Source

isEmpty :: (Typeable a, QueueConstraints w r a) => RefQueue a -> IO BoolSource

check if the queue is empty

isEmptySTM :: (Typeable a, QueueConstraints w r a) => RefQueue a -> STM BoolSource