QpackDynamicTable
struct QpackDynamicTableInsert-ordered, capacity-bounded dynamic table (RFC 9204 3.2).
entries[0] is the oldest live entry. dropped counts entries
evicted over the table's lifetime, so the absolute index of
entries[0] is dropped and the next insert lands at absolute
index insert_count() (== dropped + len(entries)).
Implements Copyable, Movable
- Fields
entries: List[HpackHeader]capacity: UInt64max_capacity: UInt64: The ceiling :meth:set_capacitymay raisecapacityto: the SETTINGS_QPACK_MAX_TABLE_CAPACITY this side advertised (RFC 9204 sec 3.2.3).size: UInt64dropped: UInt64
__init__
def __init__(out self, capacity: UInt64 = UInt64(0)) insert_count
def insert_count(self) -> UInt64 Total inserts ever (the absolute index of the next insert).
max_entries
def max_entries(self) -> UInt64 RFC 9204 section 3.2.2 MaxEntries = floor(capacity / 32).
set_capacity
def set_capacity(mut self, cap: UInt64) Set the table capacity, evicting the oldest entries until the size fits (RFC 9204 section 4.3.1).
Raises QPACK_ENCODER_STREAM_ERROR above :attr:max_capacity
(sec 4.3.1). Any value was accepted, so a peer could grow our
dynamic table past the limit we advertised, which is 0 by
default, and fill it with inserts of any size.
insert
def insert(mut self, var h: HpackHeader) -> Bool Insert h after evicting to make room. Returns False if the entry cannot fit even in an empty table (RFC 9204 section 3.2.2 -- such an insert is a no-op the caller treats as an error).
get_abs
def get_abs(self, abs_index: UInt64) -> HpackHeader Resolve an absolute index to its entry.
find
def find(self, h: HpackHeader) -> Int Absolute index of a full (name, value) match, or -1.
find_name
def find_name(self, name: String) -> Int Absolute index of a name match, or -1.