nhttp_qpack_dynamic_table (nhttp_lib v1.0.0)

View Source

QPACK dynamic table implementation based on RFC 9204 Section 3.2.

Uses map-based O(1) lookups for both forward (absolute index to entry) and reverse (name/value to absolute index) directions.

Summary

Functions

Return the current capacity.

Return the current size in bytes.

Return the drop count.

Evict the oldest entry from the table.

Reverse lookup by name and value. Returns {ok, Index} for an exact match, {name, Index} for a name-only match, or error if nothing is found.

Insert a header field entry, evicting as needed.

Return the insert count.

Look up an entry by absolute index.

Create a new dynamic table with the given maximum capacity.

Set the dynamic table capacity, evicting entries if needed.

Types

entry()

-type entry() :: {binary(), binary()}.

t()

-opaque t()

Functions

capacity/1

-spec capacity(t()) -> non_neg_integer().

Return the current capacity.

current_size/1

-spec current_size(t()) -> non_neg_integer().

Return the current size in bytes.

drop_count/1

-spec drop_count(t()) -> non_neg_integer().

Return the drop count.

evict/1

-spec evict(t()) -> {ok, t()} | {error, empty}.

Evict the oldest entry from the table.

find/3

-spec find(binary(), binary(), t()) -> {ok, non_neg_integer()} | {name, non_neg_integer()} | error.

Reverse lookup by name and value. Returns {ok, Index} for an exact match, {name, Index} for a name-only match, or error if nothing is found.

insert(Name, Value, Table)

-spec insert(binary(), binary(), t()) -> {ok, t()} | {error, no_space}.

Insert a header field entry, evicting as needed.

insert_count/1

-spec insert_count(t()) -> non_neg_integer().

Return the insert count.

lookup/2

-spec lookup(non_neg_integer(), t()) -> {ok, entry()} | {error, bad_index}.

Look up an entry by absolute index.

new(MaxCapacity)

-spec new(non_neg_integer()) -> {ok, t()}.

Create a new dynamic table with the given maximum capacity.

set_capacity/2

-spec set_capacity(non_neg_integer(), t()) -> {ok, t()} | {error, exceeds_max}.

Set the dynamic table capacity, evicting entries if needed.