Skip to main content

Module filter

Module filter 

Source
Expand description

The topic filter grammar of docs/PROTOCOL.md §6.4.

A topic and a filter are byte strings split on filter::SEPARATOR into segments. The two wildcards are whole-segment tokens, and everything else is literal: there is no escape character, no normalization and no case folding (decisions/0007 §4.2). Both halves of the grammar live here: filter::validate, the rule that says which filters may exist at all — so an illegal one is refused at the codec boundary rather than reaching a matcher that would have to cope with it — and filter::matches, the matcher itself. The matcher used to sit with the fan-out it served, in weida::pubsub, and moved when a second layer needed it: an L2 queue selects a consumer with the same grammar (B-202), and a second implementation of a wildcard language is exactly the kind of drift one definition exists to prevent.

Constants§

ONE_SEGMENT
Matches exactly one whole segment.
REST
Matches zero or more trailing segments; legal only as the last segment.
SEPARATOR
Segment separator: ., one byte.

Functions§

matches
Does topic match filter?
validate
Checks filter against the grammar.