Safe Haskell | Safe-Infered |
---|

This module implements a persistent, transactional collection with Queue interface as well as indexed access by key

use this version if you store in the queue different versions of largue structures, for example, documents and define a Data.RefSerialize instance. If not, use Data.Persistent.Queue.Binary Instead.

Here `QueueConstraints w r a`

means `Data.RefSerlialize.Serialize a`

- type RefQueue a = DBRef (Queue a)
- getQRef :: (Typeable a, Serialize a) => String -> RefQueue a
- pop :: (Typeable a, Serialize a) => RefQueue a -> IO a
- popSTM :: (Typeable a, Serialize a) => RefQueue a -> STM a
- pick :: (Typeable a, Serialize a) => RefQueue a -> IO a
- flush :: (Typeable a, Serialize a) => RefQueue a -> IO ()
- flushSTM :: (Typeable a, Serialize a) => RefQueue a -> STM ()
- pickAll :: (Typeable a, Serialize a) => RefQueue a -> IO [a]
- pickAllSTM :: (Typeable a, Serialize a) => RefQueue a -> STM [a]
- push :: (Typeable a, Serialize a) => RefQueue a -> a -> IO ()
- pushSTM :: (Typeable a, Serialize a) => RefQueue a -> a -> STM ()
- pickElem :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> String -> IO (Maybe a)
- pickElemSTM :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> String -> STM (Maybe a)
- readAll :: (Typeable a, Serialize a) => RefQueue a -> IO [a]
- readAllSTM :: (Typeable a, Serialize a) => RefQueue a -> STM [a]
- deleteElem :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> a -> IO ()
- deleteElemSTM :: (Typeable a, Serialize a, Indexable a) => RefQueue a -> a -> STM ()
- unreadSTM :: (Typeable a, Serialize a) => RefQueue a -> a -> STM ()
- isEmpty :: (Typeable a, Serialize a) => RefQueue a -> IO Bool
- isEmptySTM :: (Typeable a, Serialize a) => RefQueue a -> STM Bool

# Documentation

getQRef :: (Typeable a, Serialize a) => String -> RefQueue aSource

get the reference to new or existing queue trough its name

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

flush :: (Typeable a, Serialize a) => RefQueue a -> IO ()Source

empty the queue (factually, it is deleted)

pickAll :: (Typeable a, Serialize a) => RefQueue a -> IO [a]Source

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

pickElem :: (Indexable a, Typeable a, Serialize 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, Serialize a) => RefQueue a -> String -> STM (Maybe a)Source

version in the STM monad

readAll :: (Typeable a, Serialize a) => RefQueue a -> IO [a]Source

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

deleteElem :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> a -> IO ()Source

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