Table of Contents

Class KeyExpression

Namespace
Pamoja.Zenoh
Assembly
Pamoja.Zenoh.dll

The naming rules a Zenoh network addresses data by.

public static class KeyExpression
Inheritance
KeyExpression
Inherited Members

Remarks

A key expression is a slash-separated path that may carry the * and ** wildcards, so one subscriber names a whole subtree of a fleet rather than each node in it. A chunk that starts with @ is verbatim, and no wildcard selects it. Only the naming rules cross: running a Zenoh session needs the std-only zenoh stack, which stays in the Rust crate.

Methods

Canonize(string)

Rewrites a key expression into its canonical form.

public static string? Canonize(string key)

Parameters

key string

The expression to canonize.

Returns

string

The canonical form, or null if the expression is malformed.

Remarks

Two expressions that select the same data have one canonical form, so canonizing before comparing or routing keeps equivalent expressions equal.

Includes(string, string)

Reports whether one key expression selects every key another selects.

public static bool Includes(string a, string b)

Parameters

a string

The expression that may be the wider one.

b string

The expression tested for being covered by a.

Returns

bool

true when every key b selects is also selected by a, or false if not or either expression is malformed.

Intersects(string, string)

Reports whether two key expressions share at least one key.

public static bool Intersects(string a, string b)

Parameters

a string

One expression.

b string

The other expression.

Returns

bool

true when some key is selected by both, or false if none is or either expression is malformed.

Remarks

This is the relation Zenoh routes by: a publication on one reaches a subscriber on the other exactly when the two intersect.

IsCanon(string)

Reports whether a key expression is already canonical.

public static bool IsCanon(string key)

Parameters

key string

The expression to check.

Returns

bool

true when the expression is canonical.

Remarks

The canonical form is the only one a Zenoh session accepts.

IsValid(string)

Reports whether a key expression is well formed.

public static bool IsValid(string key)

Parameters

key string

The expression to check.

Returns

bool

true when the expression is valid.

Join(string, string)

Joins two key expressions with a slash and canonizes the result.

public static string? Join(string prefix, string suffix)

Parameters

prefix string

The leading expression.

suffix string

The expression to place beneath it.

Returns

string

The joined expression in canonical form, or null if either side is empty or the joined expression is malformed.

Matches(string, string)

Reports whether a pattern selects a concrete key.

public static bool Matches(string pattern, string key)

Parameters

pattern string

The expression that may carry wildcards.

key string

The concrete key to test against it.

Returns

bool

true when the pattern selects the key.