http2-1.2.0: HTTP/2.0 library including frames and HPACK

Safe HaskellSafe
LanguageHaskell2010

Network.HTTP2.Priority

Contents

Description

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, ...

Only one entry per stream should be enqueued.

Synopsis

PriorityTree

data PriorityTree a Source

Abstract data type for priority trees.

newPriorityTree :: IO (PriorityTree a) Source

Creating a new priority tree.

PriorityTree functions

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 -> StreamId -> Priority -> a -> IO () Source

Enqueuing an entry to the priority tree. This must be used for Header frame. If controlPriority is specified, it is treated as a control frame and top-queued.

dequeue :: PriorityTree a -> IO (StreamId, a) Source

Dequeuing an entry from the priority tree.

delete :: PriorityTree a -> StreamId -> Priority -> IO (Maybe a) Source

Deleting the entry corresponding to StreamId. delete and enqueue are used to change the priority of a live stream.

clear :: PriorityTree a -> StreamId -> Priority -> IO () Source

Clearing the internal state for StreamId from PriorityTree. When a stream is closed, this function MUST be called to prevent memory leak.