-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Transactional cache with user-defined persistence -- -- TCache is a transactional cache with configurable persitence. It -- allows conventional STM transactions for objects that syncronize with -- their user defined storages. State in memory and into permanent -- storage is transactionally coherent. -- -- The package implements serializable STM references, access by key and -- by record field value, triggers, full text and field indexation, -- default serialization and a query language based on record fields -- -- This version add memoization and a persistent and transactional -- collection/queue -- -- See Data.TCache for details @package TCache @version 0.10.0.2 module Data.TCache.IResource -- | Must be defined for every object to be cached. class IResource a where readResource x = readResourceByKey $ keyResource x keyResource :: IResource a => a -> String readResourceByKey :: IResource a => String -> IO (Maybe a) readResource :: IResource a => a -> IO (Maybe a) writeResource :: IResource a => a -> IO () delResource :: IResource a => a -> IO () -- | Resources data definition used by withSTMResources data Resources a b -- | forces a retry Retry :: Resources a b Resources :: [a] -> [a] -> b -> Resources a b -- | resources to be inserted back in the cache toAdd :: Resources a b -> [a] -- | resources to be deleted from the cache and from permanent storage toDelete :: Resources a b -> [a] -- | result to be returned toReturn :: Resources a b -> b -- | Empty resources: resources= Resources [] [] () resources :: Resources a () -- | some internal definitions. To use default persistence, use -- DefaultPersistence instead module Data.TCache.Defs type AccessTime = Integer type ModifTime = Integer data Status a NotRead :: Status a DoNotExist :: Status a Exist :: a -> Status a data Elem a Elem :: !a -> !AccessTime -> !ModifTime -> Elem a type TPVar a = TVar (Status (Elem a)) data DBRef a DBRef :: !String -> !(TPVar a) -> DBRef a castErr :: (Typeable a, Typeable a1) => a -> a1 -- | Indexable is an utility class used to derive instances of IResource -- -- Example: -- --
-- data Person= Person{ pname :: String, cars :: [DBRef Car]} deriving (Show, Read, Typeable)
-- data Car= Car{owner :: DBRef Person , cname:: String} deriving (Show, Read, Eq, Typeable)
--
--
-- Since Person and Car are instances of Read ans Show, by
-- defining the Indexable instance will implicitly define the
-- IResource instance for file persistence:
--
--
-- instance Indexable Person where key Person{pname=n} = "Person " ++ n
-- instance Indexable Car where key Car{cname= n} = "Car " ++ n
--
class Indexable a where defPath = const "TCacheData/"
key :: Indexable a => a -> String
defPath :: Indexable a => a -> String
-- | Serialize is an alternative to the IResource class for defining
-- persistence in TCache. The deserialization must be as lazy as
-- possible. serialization/deserialization are not performance critical
-- in TCache
--
-- Read, Show, instances are implicit instances of Serializable
--
-- -- serialize = show -- deserialize= read ---- -- Since write and read to disk of to/from the cache are not be very -- frequent The performance of serialization is not critical. class Serializable a where setPersist _ = defaultPersist serialize :: Serializable a => a -> ByteString deserialize :: Serializable a => ByteString -> a setPersist :: Serializable a => a -> Persist -- | a persist mechanism has to implement these three primitives -- defaultpersist is the default file persistence data Persist -- | delete Persist :: (String -> IO (Maybe ByteString)) -> (String -> ByteString -> IO ()) -> (String -> IO ()) -> Persist -- | read by key. It must be strict readByKey :: Persist -> (String -> IO (Maybe ByteString)) -- | write. It must be strict write :: Persist -> (String -> ByteString -> IO ()) delete :: Persist -> (String -> IO ()) -- | Implements default persistence of objects in files with their keys as -- filenames defaultPersist :: Persist getPersist :: Serializable a => a -> IO Persist defaultReadByKey :: String -> IO (Maybe ByteString) defaultWrite :: String -> ByteString -> IO () safeWrite :: [Char] -> ByteString -> IO () defaultDelete :: String -> IO () defReadResourceByKey :: (Serializable a, Indexable a) => [Char] -> IO (Maybe a) defWriteResource :: (Serializable a, Indexable a) => a -> IO () defDelResource :: (Serializable a, Indexable a) => a -> IO () -- | Strict read from file, needed for default file persistence readFileStrict :: FilePath -> IO ByteString instance [overlap ok] Typeable1 Status instance [overlap ok] Typeable1 Elem instance [overlap ok] Typeable1 DBRef module Data.TCache.Triggers data DBRef a DBRef :: !String -> !(TPVar a) -> DBRef a data Elem a Elem :: !a -> !AccessTime -> !ModifTime -> Elem a data Status a NotRead :: Status a DoNotExist :: Status a Exist :: a -> Status a -- | Add an user defined trigger to the list of triggers Trriggers are -- called just before an object of the given type is created, modified or -- deleted. The DBRef to the object and the new value is passed to the -- trigger. The called trigger function has two parameters: the DBRef -- being accesed (which still contains the old value), and the new value. -- If the content of the DBRef is being deleted, the second parameter is -- Nothing. if the DBRef contains Nothing, then the object is -- being created addTrigger :: (IResource a, Typeable a) => ((DBRef a) -> Maybe a -> STM ()) -> IO () applyTriggers :: (IResource a, Typeable a) => [DBRef a] -> [Maybe a] -> STM () instance [overlap ok] Typeable1 TriggerType -- | TCache is a transactional cache with configurable persitence that -- permits STM transactions with objects that syncronize sincromous or -- asyncronously with their user defined storages. Default persistence in -- files is provided by default -- -- TCache implements ''DBRef' 's . They are persistent STM references -- with a typical Haskell interface. simitar to TVars (newDBRef, -- readDBRef, writeDBRef etc) but with added. persistence . -- DBRefs are serializable, so they can be stored and retrieved. Because -- they are references,they point to other serializable registers. This -- permits persistent mutable Inter-object relations -- -- For simple transactions of lists of objects of the same type TCache -- implements inversion of control primitives withSTMResources and -- variants, that call pure user defined code for registers update. -- Examples below. -- -- Triggers in Data.TCache.Triggers are user defined hooks that -- are called back on register updates. .They are used internally for -- indexing. -- -- Data.TCache.IndexQuery implements an straighforwards pure -- haskell type safe query language based on register field relations. -- This module must be imported separately. -- -- Data.TCache.IndexText add full text search and content search -- to the query language -- -- Data.TCache.DefaultPersistence has instances for key indexation -- , serialization and default file persistence. The file persistence is -- more reliable, and the embedded IO reads inside STM transactions are -- safe. -- -- Data.Persistent.Collection implements a persistent, -- transactional collection with Queue interface as well as indexed -- access by key module Data.TCache -- | Perform a series of STM actions atomically. -- -- You cannot use atomically inside an unsafePerformIO or -- unsafeInterleaveIO. Any attempt to do so will result in a -- runtime error. (Reason: allowing this would effectively allow a -- transaction inside a transaction, depending on exactly when the thunk -- is evaluated.) -- -- However, see newTVarIO, which can be called inside -- unsafePerformIO, and which allows top-level TVars to be -- allocated. atomically :: STM a -> IO a -- | Perform a synchronization of the cache with permanent storage once -- executed the STM transaction when syncWrite policy is -- Synchronous atomicallySync :: STM a -> IO a -- | A monad supporting atomic memory transactions. data STM a :: * -> * -- | Unsafely performs IO in the STM monad. Beware: this is a highly -- dangerous thing to do. -- --
-- withResources rs f= atomically $ withSTMResources rs f1 >> return() where f1 mrs= let as= f mrs in Resources as [] () --withResources :: (IResource a, Typeable a) => [a] -> ([Maybe a] -> [a]) -> IO () -- | Update of a single object in the cache -- --
-- withResource r f= withResources [r] ([mr]-> [f mr]) --withResource :: (IResource a, Typeable a) => a -> (Maybe a -> a) -> IO () -- | To read a list of resources from the cache if they exist -- -- | getResources rs= atomically $ withSTMResources rs f1 -- where f1 mrs= Resources [] [] mrs getResources :: (IResource a, Typeable a) => [a] -> IO [Maybe a] -- | To read a resource from the cache. -- --
-- getResource r= do{mr<- getResources [r];return $! head mr}
--
getResource :: (IResource a, Typeable a) => a -> IO (Maybe a)
-- | Delete the list of resources from cache and from persistent storage.
--
-- -- deleteResources rs= atomically $ withSTMResources rs f1 where f1 mrs = Resources [] (catMaybes mrs) () --deleteResources :: (IResource a, Typeable a) => [a] -> IO () -- | Delete the resource from cache and from persistent storage. -- --
-- deleteResource r= deleteResources [r] --deleteResource :: (IResource a, Typeable a) => a -> IO () -- | Add an user defined trigger to the list of triggers Trriggers are -- called just before an object of the given type is created, modified or -- deleted. The DBRef to the object and the new value is passed to the -- trigger. The called trigger function has two parameters: the DBRef -- being accesed (which still contains the old value), and the new value. -- If the content of the DBRef is being deleted, the second parameter is -- Nothing. if the DBRef contains Nothing, then the object is -- being created addTrigger :: (IResource a, Typeable a) => ((DBRef a) -> Maybe a -> STM ()) -> IO () -- | Deletes the pointed object from the cache, not the database (see -- delDBRef) useful for cache invalidation when the database is -- modified by other process flushDBRef :: (IResource a, Typeable a) => DBRef a -> STM () -- | drops the entire cache. flushAll :: STM () type Cache = IORef (Ht, Integer) -- | Set the cache. this is useful for hot loaded modules that will update -- an existing cache. Experimental setCache :: Cache -> IO () -- | Creates a new cache. Experimental newCache :: IO (Ht, Integer) -- | Force the atomic write of all cached objects modified since the last -- save into permanent storage. Cache writes allways save a coherent -- state. As allways, only the modified objects are written. syncCache :: IO () -- | stablishes the procedures to call before and after saving with -- syncCache, clearSyncCache or clearSyncCacheProc. -- The postcondition of database persistence should be a commit. setConditions :: IO () -> IO () -> IO () -- | Saves the unsaved elems of the cache. Cache writes allways save a -- coherent state. Unlike syncChace this call deletes some elems -- of the cache when the number of elems > sizeObjects. The -- deletion depends on the check criteria, expressed by the first -- parameter. defaultCheck is the one implemented to be passed by -- default. Look at it to understand the clearing criteria. clearSyncCache :: (Integer -> Integer -> Integer -> Bool) -> Int -> IO () -- | Return the total number of DBRefs in the cache. For debug purposes. -- This does not count the number of objects in the cache since many of -- the DBRef may not have the pointed object loaded. It's O(n). numElems :: IO Int -- | Specify the cache synchronization policy with permanent storage. See -- SyncMode for details syncWrite :: SyncMode -> IO () data SyncMode -- | sync state to permanent storage when atomicallySync is invoked Synchronous :: SyncMode Asyncronous :: Int -> (Integer -> Integer -> Integer -> Bool) -> Int -> SyncMode -- | number of seconds between saves when asyncronous frecuency :: SyncMode -> Int -- | The user-defined check-for-cleanup-from-cache for each object. -- defaultCheck is an example check :: SyncMode -> (Integer -> Integer -> Integer -> Bool) -- | size of the cache when async cacheSize :: SyncMode -> Int -- | use syncCache to write the state SyncManual :: SyncMode -- | Start the thread that periodically call clearSyncCache to clean -- and writes on the persistent storage. Otherwise, syncCache or -- clearSyncCache or atomicallySync must be invoked -- explicitly or no persistence will exist. Cache writes allways save a -- coherent state clearSyncCacheProc :: Int -> (Integer -> Integer -> Integer -> Bool) -> Int -> IO ThreadId -- | This is a default cache clearance check. It forces to drop from the -- cache all the elems not accesed since half the time between now and -- the last sync if it returns True, the object will be discarded from -- the cache it is invoked when the cache size exceeds the number of -- objects configured in clearSyncCacheProc or -- clearSyncCache defaultCheck :: Integer -> Integer -> Integer -> Bool -- | Handles Nothing cases in a simpler way than runMaybeT. it is used in -- infix notation. for example: -- --
-- result <- readDBRef ref `onNothing` error ("Not found "++ keyObjDBRef ref)
--
--
-- or
--
-- -- result <- readDBRef ref `onNothing` return someDefaultValue --onNothing :: Monad m => m (Maybe b) -> m b -> m b instance [overlap ok] Ord (DBRef a) instance [overlap ok] Eq (DBRef a) instance [overlap ok] (IResource a, Typeable a) => Read (DBRef a) instance [overlap ok] Show (DBRef a) module Data.TCache.DefaultPersistence -- | Indexable is an utility class used to derive instances of IResource -- -- Example: -- --
-- data Person= Person{ pname :: String, cars :: [DBRef Car]} deriving (Show, Read, Typeable)
-- data Car= Car{owner :: DBRef Person , cname:: String} deriving (Show, Read, Eq, Typeable)
--
--
-- Since Person and Car are instances of Read ans Show, by
-- defining the Indexable instance will implicitly define the
-- IResource instance for file persistence:
--
--
-- instance Indexable Person where key Person{pname=n} = "Person " ++ n
-- instance Indexable Car where key Car{cname= n} = "Car " ++ n
--
class Indexable a where defPath = const "TCacheData/"
key :: Indexable a => a -> String
defPath :: Indexable a => a -> String
-- | Serialize is an alternative to the IResource class for defining
-- persistence in TCache. The deserialization must be as lazy as
-- possible. serialization/deserialization are not performance critical
-- in TCache
--
-- Read, Show, instances are implicit instances of Serializable
--
-- -- serialize = show -- deserialize= read ---- -- Since write and read to disk of to/from the cache are not be very -- frequent The performance of serialization is not critical. class Serializable a where setPersist _ = defaultPersist serialize :: Serializable a => a -> ByteString deserialize :: Serializable a => ByteString -> a setPersist :: Serializable a => a -> Persist -- | Implements default persistence of objects in files with their keys as -- filenames defaultPersist :: Persist -- | a persist mechanism has to implement these three primitives -- defaultpersist is the default file persistence data Persist -- | delete Persist :: (String -> IO (Maybe ByteString)) -> (String -> ByteString -> IO ()) -> (String -> IO ()) -> Persist -- | read by key. It must be strict readByKey :: Persist -> (String -> IO (Maybe ByteString)) -- | write. It must be strict write :: Persist -> (String -> ByteString -> IO ()) delete :: Persist -> (String -> IO ()) instance [overlap ok] (Typeable a, Indexable a, Serializable a) => IResource a -- | This module implements an experimental typed query language for TCache -- build on pure haskell. It is minimally intrusive (no special data -- definitions, no special syntax, no template haskell). It uses the same -- register fields from the data definitions. Both for query conditions -- and selections. It is executed in haskell, no external database -- support is needed. -- -- it includes -- --
-- import Data.TCache
-- import Data.TCache.IndexQuery
-- import Data.TCache.DefaultPersistence
-- import Data.Typeable
--
-- data Person= Person {pname :: String} deriving (Show, Read, Eq, Typeable)
-- data Car= Car{owner :: DBRef Person , cname:: String} deriving (Show, Read, Eq, Typeable)
--
-- instance Indexable Person where key Person{pname= n} = "Person " ++ n
-- instance Indexable Car where key Car{cname= n} = "Car " ++ n
--
-- main = do
-- index owner
-- index pname
-- index cname
-- bruce <- atomically $ newDBRef $ Person "bruce"
-- atomically $ mapM_ newDBRef [Car bruce "Bat Mobile", Car bruce "Porsche"]
-- r <- atomically $ cname .==. "Porsche"
-- print r
-- r <- atomically $ select (cname, owner) $ (owner .==. bruce) .&&. (cname .>=. "Bat Mobile")
-- print r
--
--
-- Will produce:
--
--
-- [DBRef "Car Porsche"]
-- [("Porsche",DBRef "Person bruce")]
--
--
-- NOTES:
--
--
-- data Person = Person {name , surname :: String}
--
--
-- then a query for name .==. Bruce is
-- indistinguishable from surname .==. Bruce
--
-- Will return indexOf the registers with surname Bruce as well.
-- So if two or more fields in a registers are to be indexed, they must
-- have different types.
module Data.TCache.IndexQuery
-- | Register a trigger for indexing the values of the field passed as
-- parameter. the indexed field can be used to perform relational-like
-- searches
index :: Queriable reg a => (reg -> a) -> IO ()
-- | implement the relational-like operators, operating on record fields
class RelationOps field1 field2 res | field1 field2 -> res
(.==.) :: RelationOps field1 field2 res => field1 -> field2 -> STM res
(.>.) :: RelationOps field1 field2 res => field1 -> field2 -> STM res
(.>=.) :: RelationOps field1 field2 res => field1 -> field2 -> STM res
(.<=.) :: RelationOps field1 field2 res => field1 -> field2 -> STM res
(.<.) :: RelationOps field1 field2 res => field1 -> field2 -> STM res
-- | return all the (indexed) registers which has this field
indexOf :: Queriable reg a => (reg -> a) -> STM [(a, [DBRef reg])]
recordsWith :: (IResource a, Typeable a) => STM [DBRef a] -> STM [a]
(.&&.) :: SetOperations set set' setResult => STM set -> STM set' -> STM setResult
(.||.) :: SetOperations set set' setResult => STM set -> STM set' -> STM setResult
class Select selector a res | selector a -> res
select :: Select selector a res => selector -> a -> res
instance [incoherent] Typeable2 Index
instance [incoherent] Show a => Show (Index reg a)
instance [incoherent] (Typeable reg, IResource reg, Typeable reg', IResource reg', Select (reg -> a) (STM [DBRef reg]) (STM [a]), Select (reg' -> b) (STM [DBRef reg']) (STM [b])) => Select (reg -> a, reg' -> b) (STM (JoinData reg reg')) (STM [([a], [b])])
instance [incoherent] (Typeable reg, IResource reg, Select (reg -> a) (STM [DBRef reg]) (STM [a]), Select (reg -> b) (STM [DBRef reg]) (STM [b]), Select (reg -> c) (STM [DBRef reg]) (STM [c]), Select (reg -> d) (STM [DBRef reg]) (STM [d])) => Select (reg -> a, reg -> b, reg -> c, reg -> d) (STM [DBRef reg]) (STM [(a, b, c, d)])
instance [incoherent] (Typeable reg, IResource reg, Select (reg -> a) (STM [DBRef reg]) (STM [a]), Select (reg -> b) (STM [DBRef reg]) (STM [b]), Select (reg -> c) (STM [DBRef reg]) (STM [c])) => Select (reg -> a, reg -> b, reg -> c) (STM [DBRef reg]) (STM [(a, b, c)])
instance [incoherent] (Typeable reg, IResource reg, Select (reg -> a) (STM [DBRef reg]) (STM [a]), Select (reg -> b) (STM [DBRef reg]) (STM [b])) => Select (reg -> a, reg -> b) (STM [DBRef reg]) (STM [(a, b)])
instance [incoherent] (Typeable reg, IResource reg) => Select (reg -> a) (STM [DBRef reg]) (STM [a])
instance [incoherent] SetOperations (JoinData a a') [DBRef a'] (JoinData a a')
instance [incoherent] SetOperations [DBRef a] (JoinData a a') (JoinData a a')
instance [incoherent] SetOperations (JoinData a a') [DBRef a] (JoinData a a')
instance [incoherent] SetOperations [DBRef a] [DBRef a] [DBRef a]
instance [incoherent] (Queriable reg a, Queriable reg' a) => RelationOps (reg -> a) (reg' -> a) (JoinData reg reg')
instance [incoherent] Queriable reg a => RelationOps (reg -> a) a [DBRef reg]
instance [incoherent] (Typeable reg, Typeable a) => Indexable (Index reg a)
instance [incoherent] Queriable reg a => Serializable (Index reg a)
instance [incoherent] (IResource reg, Typeable reg, Read reg, Show reg, Show a, Read a, Ord a) => Read (Index reg a)
instance [incoherent] Queriable reg a => IResource (Index reg a)
instance [incoherent] (Read reg, Read a, Show reg, Show a, IResource reg, Typeable reg, Typeable a, Ord a) => Queriable reg a
-- | Implements full text indexation (indexText) and text
-- search(contains), as an addition to the query language
-- implemented in IndexQuery it also can index the lists of
-- elements in a field (with indexList) so that it is possible to
-- ask for the registers that contains a given element in the given field
-- (with containsElem)
--
-- An example of full text search i before and after an update in the
-- text field
--
--
-- data Doc= Doc{title, body :: String} deriving (Read,Show, Typeable)
-- instance Indexable Doc where
-- key Doc{title=t}= t
--
-- instance Serializable Doc where
-- serialize= pack . show
-- deserialize= read . unpack
--
-- main= do
-- indexText body T.pack
-- let doc= Doc{title= title, body= "hola que tal estamos"}
-- rdoc <- atomically $ newDBRef doc
-- r1 <- atomically $ select title $ body `'contains'\` "hola que tal"
-- print r1
--
-- atomically $ writeDBRef rdoc doc{ body= que tal}
-- r <- atomically $ select title $ body `'contains'\` "hola que tal"
-- print r
-- if r1 == [title doc] then print "OK" else print "FAIL"
-- if r== [] then print "OK" else print "FAIL"
--
module Data.TCache.IndexText
-- | start a trigger to index the contents of a register field
indexText :: (IResource a, Typeable a, Typeable b) => (a -> b) -> (b -> Text) -> IO ()
-- | trigger the indexation of list fields with elements convertible to
-- Text
indexList :: (IResource a, Typeable a, Typeable b) => (a -> b) -> (b -> [Text]) -> IO ()
-- | return the DBRefs whose fields include all the words of length three
-- or more in the requested text contents
contains :: (IResource a, Typeable a, Typeable b) => (a -> b) -> String -> STM [DBRef a]
-- | return the DBRefs whose fields (usually of container type) contains
-- the requested value.
containsElem :: (IResource a, Typeable a, Typeable b) => (a -> b) -> String -> STM [DBRef a]
instance [overlap ok] Typeable IndexText
instance [overlap ok] IResource IndexText
instance [overlap ok] Indexable IndexText
instance [overlap ok] Serializable IndexText
instance [overlap ok] Read IndexText
instance [overlap ok] Show IndexText
module Data.TCache.Memoization
-- | Memoize the result of a computation for a certain time. A string
-- key is used to index the result
--
-- The Int parameter is the timeout, in second after the last evaluation,
-- after which the cached value will be discarded and the expression will
-- be evaluated again if demanded . Time == 0 means no timeout
cachedByKey :: (Typeable a, Executable m, MonadIO m) => String -> Int -> m a -> m a
-- | a pure version of cached
cachedp :: (Indexable a, Typeable a, Typeable b) => (a -> b) -> a -> b
-- | return a string identifier for any object
addrStr :: MonadIO m => a -> m String
-- | return a hash of an object
addrHash :: MonadIO m => a -> m Int
-- | to execute a monad for the purpose of memoizing its result
class Executable m
execute :: Executable m => m a -> a
instance [overlap ok] Typeable2 Cached
instance [overlap ok] Indexable String
instance [overlap ok] (Indexable a, Typeable a) => IResource (Cached a b)
instance [overlap ok] MonadIO Identity
instance [overlap ok] Executable Identity
instance [overlap ok] Executable IO
-- | A persistent, transactional collection with Queue interface as well as
-- indexed access by key.
--
-- Uses default persistence. See Data.TCache.DefaultPersistence
module Data.Persistent.Collection
-- | A queue reference
type RefQueue a = DBRef (Queue a)
-- | Get the reference to new or existing queue trough its name
getQRef :: (Typeable a, Serialize a) => String -> RefQueue a
-- | Read the first element in the queue and delete it (pop)
pop :: (Typeable a, Serialize a) => RefQueue a -> IO a
-- | Version in the STM monad
popSTM :: (Typeable a, Serialize a) => RefQueue a -> STM a
pick :: (Typeable a, Serialize a) => RefQueue a -> IO a
-- | Empty the queue (factually, it is deleted)
flush :: (Typeable a, Serialize a) => RefQueue a -> IO ()
-- | Version in the STM monad
flushSTM :: (Typeable a, Serialize a) => RefQueue a -> STM ()
-- | Return the list of all elements in the queue. The queue remains
-- unchanged
pickAll :: (Typeable a, Serialize a) => RefQueue a -> IO [a]
-- | Version in the STM monad
pickAllSTM :: (Typeable a, Serialize a) => RefQueue a -> STM [a]
-- | Push an element in the queue
push :: (Typeable a, Serialize a) => RefQueue a -> a -> IO ()
-- | Version in the STM monad
pushSTM :: (Typeable a, Serialize a) => RefQueue a -> a -> STM ()
-- | Return the first element in the queue that has the given key
pickElem :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> String -> IO (Maybe a)
-- | Version in the STM monad
pickElemSTM :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> String -> STM (Maybe a)
-- | Return the list of all elements in the queue and empty it
readAll :: (Typeable a, Serialize a) => RefQueue a -> IO [a]
-- | A version in the STM monad
readAllSTM :: (Typeable a, Serialize a) => RefQueue a -> STM [a]
-- | Delete all the elements of the queue that has the key of the parameter
-- passed
deleteElem :: (Indexable a, Typeable a, Serialize a) => RefQueue a -> a -> IO ()
-- | Verison in the STM monad
deleteElemSTM :: (Typeable a, Serialize a, Indexable a) => RefQueue a -> a -> STM ()
unreadSTM :: (Typeable a, Serialize a) => RefQueue a -> a -> STM ()
-- | Check if the queue is empty
isEmpty :: (Typeable a, Serialize a) => RefQueue a -> IO Bool
isEmptySTM :: (Typeable a, Serialize a) => RefQueue a -> STM Bool
instance [overlap ok] Typeable1 Queue
instance [overlap ok] Serialize a => Serializable (Queue a)
instance [overlap ok] Serialize a => Serialize (Queue a)
instance [overlap ok] Indexable (Queue a)