Expand description
The Zenoh key-expression language: validity, canonical form, matching, and the relations between two expressions.
A key expression is a /-joined list of non-empty chunks. A chunk is either a literal, the
single-chunk wildcard * (one non-empty chunk), the multi-chunk wildcard ** (zero or more
chunks), or a literal carrying the sub-chunk wildcard $* (any run of characters, including
none, within one chunk). A concrete key carries no wildcards. Leading, trailing, and doubled
/ are forbidden, as are the bare characters *, $, ?, and # outside the wildcard forms.
A chunk that starts with @ is verbatim: no wildcard selects it, and only an identical chunk
matches it. That seals the keys beneath it off from every expression that does not name it, which
is how Zenoh keeps its administration space, @/..., out of a subscription on **.
The rules follow the Zenoh key-expression specification, including its canonical-form rules:
**/** collapses to **, **/* reorders to */**, $*$* collapses to $*, and a chunk that
is exactly $* becomes *. A Zenoh session accepts only the canonical form, so is_canon is
the check a key passes before it goes on the wire, and is_valid the weaker one that
canonize can repair.
Two expressions relate the way two sets do. They intersects when at least one key belongs
to both, which is the question a router asks before forwarding a publication to a subscriber,
and one includes the other when every key of the second belongs to the first, which is how a
bridge knows a new subscription adds nothing to one it already holds.
Functionsยง
- canonize
- Returns the canonical form of a key expression, or
Noneif it is invalid. - includes
- Returns whether one key expression selects every key another one selects.
- intersects
- Returns whether two key expressions share at least one key.
- is_
canon - Returns whether a key expression is valid and in canonical form.
- is_
valid - Returns whether a string is a well-formed key expression.
- join
- Joins two key expressions with a
/and returns the canonical form of the result. - matches
- Returns whether a concrete key is selected by a pattern key expression.