nhttp_qpack_static_table (nhttp_lib v1.0.0)
View SourceQPACK static table for HTTP/3 (RFC 9204 Appendix A).
This module provides the 99-entry static table used by QPACK header
compression. Forward lookup by index uses compile-time pattern matching
for O(1) access. Reverse lookups by name or name+value use maps cached
in persistent_term/0, built once at module load via the -on_load
callback below. Concurrent first-use callers therefore never race to
build the maps and never trigger more than the single global GC pair
caused by the two persistent_term:put/2 calls.
Summary
Functions
Find the smallest index matching the given header name.
Find an index matching the given header name and value.
Returns {ok, Index} for an exact name+value match,
{name, Index} if only the name matches (smallest index),
or error if the name is not found at all.
Look up a static table entry by index.
Returns {ok, {Name, Value}} for valid indices 0-98,
or {error, bad_index} for anything else.
Return the number of entries in the static table.
Types
Functions
Find the smallest index matching the given header name.
Returns {ok, Index} if the name exists in the static table,
or error if it does not. When multiple entries share the same
name, the smallest index is returned.
Find an index matching the given header name and value.
Returns {ok, Index} for an exact name+value match,
{name, Index} if only the name matches (smallest index),
or error if the name is not found at all.
-spec lookup(non_neg_integer()) -> {ok, static_entry()} | {error, bad_index}.
Look up a static table entry by index.
Returns {ok, {Name, Value}} for valid indices 0-98,
or {error, bad_index} for anything else.
-spec size() -> 99.
Return the number of entries in the static table.