Safe Haskell | None |
---|---|
Language | Haskell2010 |
This is partial implementation of the priority of HTTP/2.
This implementation does support structured priority queue but not support re-structuring. This means that it is assumed that an entry created by a Priority frame is never closed. The entry behaves an intermediate node, not a leaf.
This queue is fair for weight. Consider two weights: 201 and 101. Repeating enqueue/dequeue probably produces 201, 201, 101, 201, 201, 101, ... based on randomness.
Only one entry per stream should be enqueued. If multiple entries for a stream are inserted, the ordering is not preserved because of the randomness.
- data PriorityTree a
- newPriorityTree :: IO (PriorityTree a)
- prepare :: PriorityTree a -> StreamId -> Priority -> IO ()
- enqueue :: PriorityTree a -> a -> Priority -> IO ()
- dequeue :: PriorityTree a -> IO (a, Priority)
Documentation
data PriorityTree a Source
Abstract data type for priority trees.
newPriorityTree :: IO (PriorityTree a) Source
Creating a new priority tree.
prepare :: PriorityTree a -> StreamId -> Priority -> IO () Source
Bringing up the structure of the priority tree. This must be used for Priority frame.
enqueue :: PriorityTree a -> a -> Priority -> IO () Source
Enqueuing an element to the priority tree. This must be used for Header frame.
dequeue :: PriorityTree a -> IO (a, Priority) Source
Dequeuing an element from the priority tree.