Skip to main content

Module range_filter

Module range_filter 

Source
Expand description

The Range Filters draft-19 carries in parameter types 0x25 through 0x29.

A reader rather than a check: every rule the draft states about them is answered with a REQUEST_ERROR, which is a reply an endpoint sends and not a frame a decoder refuses. The Range Filters draft-19 carries in five parameters.

Section 5.1.3: “Range Filters are parameters in SUBSCRIBE, FETCH, or SUBSCRIBE_TRACKS that tell a publisher to filter tracks (via TRACK PROPERTY FILTER) and objects according to subscriber-provided criteria. Range filters are specified as ranges of integer values in Track and Object Properties and other Object header fields (Subgroup ID, Object ID, and Publisher Priority). There are five Range Filter parameter types, 0x25-0x29, as shown below.”

Draft-19 is the only draft with them, and the five share one value shape:

SUBGROUP_FILTER        { Type=0x25, Length, [SetID], Range... }
OBJECTID_FILTER        { Type=0x26, Length, [SetID], Range... }
PRIORITY_FILTER        { Type=0x27, Length, [SetID], Range... }
OBJECT_PROPERTY_FILTER { Type=0x28, Length, [SetID], [Property Type], Range... }
TRACK_PROPERTY_FILTER  { Type=0x29, Length, [SetID], [Property Type], Range... }
Range                  { Start, [End] }

§Why this is a reader and not a check

Every consequence Section 5.1.3 states is a reply, not a session close: “MUST be rejected with REQUEST_ERROR with error code INVALID_FILTER” for a delta that overruns, for a repeated filter key, and for more Ranges than MAX_FILTER_RANGES allows. A reply is something an endpoint sends, and sending it needs the request decoded — including the Request ID the reply names.

So nothing here is wired into decode_parameters, and RangeFilterError deliberately does not convert into CodecError. A refusal at decode time would turn a frame the endpoint owes an answer to into a frame it never saw, and the subscriber would wait for a REQUEST_ERROR that no longer has anything to be about. The five types are registered in draft-19’s parameter table as length-prefixed values, which is what keeps them carried rather than refused; this module is what makes the bytes mean something.

§The delta encoding, which is not the one used elsewhere

“Start is delta encoded from the prior Range’s End or from 0 for the first Range, and End is delta encoded from the current Range’s Start.” So the baseline alternates: a Start counts from the previous End, and an End counts from the Start beside it. The draft’s own example is ranges 3-5 and 10-15, written as 3, 2, 5, 5 — and reading it with one running baseline instead of two produces 3-5 and 8-13, a range that is wrong and well formed.

“The final End in a sequence of Ranges can be omitted to indicate no end”, so a value holding an odd number of integers ends in an unbounded range. Only the last one may be omitted, which is what makes the pairing unambiguous.

Structs§

FilterRange
One inclusive range of values, with the deltas already resolved.
RangeFilter
A decoded Range Filter parameter value.

Enums§

RangeFilterError
A Range Filter value this codec could not turn into ranges.

Constants§

OBJECT_ID_FILTER_PARAMETER
OBJECTID_FILTER, matching an Object’s Object ID.
OBJECT_PROPERTY_FILTER_PARAMETER
OBJECT_PROPERTY_FILTER, matching the value of one Object Property.
PRIORITY_FILTER_PARAMETER
PRIORITY_FILTER, matching an Object’s Publisher Priority.
SUBGROUP_FILTER_PARAMETER
SUBGROUP_FILTER, matching an Object’s Subgroup ID.
TRACK_PROPERTY_FILTER_PARAMETER
TRACK_PROPERTY_FILTER, matching the value of one Track Property.

Functions§

carries_a_property_type
Whether a Range Filter of this type carries a Property Type after its SetID.
decode_all_moqt
Read every Range Filter in a decoded parameter list, in the order they arrive.
first_repeated_key
The first key that appears twice, if any.
is_range_filter
Whether parameter_type is one of the five Range Filters.
total_ranges
The total number of Ranges across filters.

Type Aliases§

RangeFilterKey
What the key of a Range Filter is, for the rule about repeats.