tmapchan-0.0.3: An insert-ordered multimap (indexed FIFO) which consumes values as you lookup

Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.STM.TMapChan

Contents

Synopsis

Documentation

newtype TMapChan k a Source

Constructors

TMapChan 

Fields

runTMapChan :: TVar (Map k (TChan a))
 

insert :: Ord k => TMapChan k a -> k -> a -> STM () Source

insertMany :: Ord k => TMapChan k a -> k -> [a] -> STM () Source

insertFirst :: Ord k => TMapChan k a -> k -> a -> STM () Source

Inserts the element to the head of the stack, to be viewed next

lookup :: Ord k => TMapChan k a -> k -> STM a Source

Blocks until there's a value available to remove from the mutlimap

tryLookup :: Ord k => TMapChan k a -> k -> STM (Maybe a) Source

lookupAll :: Ord k => TMapChan k a -> k -> STM [a] Source

observe :: Ord k => TMapChan k a -> k -> STM a Source

Blocks until there's a vale available to view, without removing it

tryObserve :: Ord k => TMapChan k a -> k -> STM (Maybe a) Source

observeAll :: Ord k => TMapChan k a -> k -> STM [a] Source

delete :: Ord k => TMapChan k a -> k -> STM () Source

Deletes the next element in the map, if it exists. Doesn't block.

deleteAll :: Ord k => TMapChan k a -> k -> STM () Source

Clears the queue at the key

Utils

getTChan :: Ord k => TMapChan k a -> k -> STM (TChan a) Source

Creates a new one if it doesn't already exist

setTChan :: Ord k => TMapChan k a -> k -> TChan a -> STM () Source

keys :: TMapChan k a -> STM [k] Source

broadcast :: Ord k => TMapChan k a -> a -> STM () Source

Insert for every key

cloneAt Source

Arguments

:: Ord k 
=> TMapChan k a 
-> k

key to clone from

-> k

key to clone to

-> STM () 

cloneAll :: Ord k => TMapChan k a -> k -> STM () Source

Clones all the content for every key, by the key.

cloneAllUniquely :: (Ord k, Ord a) => TMapChan k a -> k -> STM () Source

Clones all the content from every channel, and inserts the unique subset of them to k, in the order of their Ord instance