class

HPack::DynamicTable

Inherits Deque < Indexable::Mutable < Indexable < Enumerable < Iterable < Reference < Object

The DynamicTable is a table of header names and values. It is implemented as a subclass of a Deque in order to get access to all of the iteration and interrogation methods without having to write methods which explicitly wrap them. Fewer lines to maintain is a win. As a caveat, though, do not interact with the storage or deletion of data via any methods other than #add, #clear, #find_index, #find_name_index, and #rebuild_index, as the native Deque methods will not keep an accurate tally of the bytesize of the structure nor of the hash indexes used for O(1) lookup.

#eviction_listener, #drop_newest, #restore_evicted, and #restore_insert_count (each marked :nodoc:) are public only because Encoder#with_writer's transactional rollback is a different class and needs to call them; they exist solely to support that rollback and are not part of this class's supported API otherwise.

Constructors

new(maximum : Int32 = 4096)
Source

Instance methods

add(name, value)
Source
bytesize
Source
clear

Removes all elements from self.

Source
find_index(name : String, value : String) : Int32 | Nil

Returns the 1-based relative index (1 = newest) of the entry whose name and value match exactly, or nil if absent.

Source
find_name_index(name : String) : Int32 | Nil

Returns the 1-based relative index (1 = newest) of the most recent entry whose name matches, or nil if absent.

Source
insert_count

Current insertion sequence counter. Exposed only for transactional rollback: some insertions made during a failed transaction may have already been evicted (and are therefore invisible to drop_newest), so the counter cannot always be recovered purely by counting drop_newest calls; rollback instead restores it directly from a value captured at transaction start.

Source
maximum
Source
maximum=(maximum : Int32)
Source
rebuild_index

Rebuilds both hash indexes from current contents. Used only on transactional rollback (rare path).

Source
resize(maximum : Int32)

Changes this table's local capacity and evicts entries as needed.

Encoder users applying a negotiated capacity change should call Encoder#resize_table instead so the peer receives the required HPACK dynamic-table size update.

Source