A LivelinessToken is a token which liveliness is tied to the Zenoh Session and can be monitored by remote applications.
see. https://docs.rs/zenoh/latest/zenoh/liveliness/index.html
Summary
Functions
Create a Subscriber for liveliness changes matching the given key expression.
Create a LivelinessToken for the given key expression.
Query liveliness tokens with matching key expressions.
Undeclare the Subscriber.
Undeclare the LivelinessToken.
Types
@type declare_subscriber_opts() :: [{:history, boolean()}]
@type get_opts() :: [{:query_timeout, non_neg_integer()}]
@type token() :: reference()
Functions
@spec declare_subscriber( Zenohex.Session.id(), String.t(), pid(), declare_subscriber_opts() ) :: {:ok, subscriber_id :: Zenohex.Subscriber.id()} | {:error, reason :: term()}
Create a Subscriber for liveliness changes matching the given key expression.
Parameters
session_id— The session to declare onkey_expr— Key expression to associate withpid- Process to receive liveliness updates (defaults toself())opts- Options for configuring the liveliness subscriber.
Examples
iex> Zenohex.Liveliness.declare_subscriber(session_id, "key/expr")
{:ok, #Reference<...>}
@spec declare_token(Zenohex.Session.id(), String.t()) :: {:ok, token()} | {:error, reason :: term()}
Create a LivelinessToken for the given key expression.
Parameters
session_id— The session to declare onkey_expr— Key expression to associate with
Examples
iex> Zenohex.Liveliness.declare_token(session_id, "key/expr")
{:ok, #Reference<...>}
@spec get(Zenohex.Session.id(), String.t(), non_neg_integer(), get_opts()) :: {:ok, [Zenohex.Sample.t() | Zenohex.Query.ReplyError.t()]} | {:error, :timeout} | {:error, reason :: term()}
Query liveliness tokens with matching key expressions.
Parameters
key_expr- The key expression matching liveliness tokens to query
Examples
iex> Zenohex.Liveliness.get(session_id, "key/expr", 100)
{:ok, [%Zenohex.Sample{}]}
@spec undeclare_subscriber(Zenohex.Subscriber.id()) :: :ok | {:error, reason :: term()}
Undeclare the Subscriber.
Parameters
subscriber_id— The ID of the subscriber to undeclare
Examples
iex> Zenohex.Liveliness.undeclare_subscriber(subscriber_id)
:ok
Undeclare the LivelinessToken.
Examples
iex> Zenohex.Liveliness.undeclare_token(token)
:ok