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

Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.STM.TMapChan.Hash

Contents

Synopsis

Documentation

newtype TMapChan k a #

Constructors

TMapChan 

Fields

insert :: (Eq k, Hashable k) => TMapChan k a -> k -> a -> STM () #

insertMany :: (Eq k, Hashable k) => TMapChan k a -> k -> [a] -> STM () #

insertFirst :: (Eq k, Hashable k) => TMapChan k a -> k -> a -> STM () #

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

lookup :: (Eq k, Hashable k) => TMapChan k a -> k -> STM a #

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

tryLookup :: (Eq k, Hashable k) => TMapChan k a -> k -> STM (Maybe a) #

lookupAll :: (Eq k, Hashable k) => TMapChan k a -> k -> STM [a] #

observe :: (Eq k, Hashable k) => TMapChan k a -> k -> STM a #

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

tryObserve :: (Eq k, Hashable k) => TMapChan k a -> k -> STM (Maybe a) #

observeAll :: (Eq k, Hashable k) => TMapChan k a -> k -> STM [a] #

delete :: (Eq k, Hashable k) => TMapChan k a -> k -> STM () #

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

deleteAll :: (Eq k, Hashable k) => TMapChan k a -> k -> STM () #

Clears the queue at the key

Utils

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

getTChan :: (Eq k, Hashable k) => TMapChan k a -> k -> STM (TChan a) #

Creates a new one if it doesn't already exist

setTChan :: (Eq k, Hashable k) => TMapChan k a -> k -> TChan a -> STM () #

broadcast :: (Eq k, Hashable k) => TMapChan k a -> a -> STM () #

cloneAt #

Arguments

:: (Eq k, Hashable k) 
=> TMapChan k a 
-> k

key to clone from

-> k

key to clone to

-> STM () 

cloneAll :: (Eq k, Hashable k) => TMapChan k a -> k -> STM () #

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

cloneAllUniquely :: (Eq k, Hashable k, Eq a, Hashable a) => TMapChan k a -> k -> STM () #

Clones all the content from every channel, and inserts the unique subset of them to k, in an unspecified order.