Zenohex.Querier (Zenohex v0.9.1-beta.1)

Copy Markdown View Source

Interface for reusable Zenoh queriers via the native layer.

Querier IDs are obtained from Zenohex.Session.declare_querier/3. A querier can issue multiple get/3 requests while reusing its declaration-time configuration.

Summary

Functions

Executes a query using the specified querier.

Executes a query asynchronously using the specified querier.

Undeclares the querier identified by the given ID.

Types

get_opts()

@type get_opts() :: [
  attachment: binary() | nil,
  encoding: String.t(),
  parameters: String.t(),
  payload: binary() | nil
]

id()

@type id() :: reference()

Functions

get(id, timeout, opts \\ [])

@spec get(id(), non_neg_integer(), get_opts()) ::
  {:ok, [Zenohex.Sample.t() | Zenohex.Query.ReplyError.t()]}
  | {:error, :timeout}
  | {:error, reason :: term()}

Executes a query using the specified querier.

The positional timeout controls how long this function waits while collecting replies. Declaration-time :query_timeout configured on the querier sets the Zenoh query timeout.

get_async(id, pid \\ self(), opts \\ [])

@spec get_async(id(), pid(), get_opts()) :: :ok | {:error, reason :: term()}

Executes a query asynchronously using the specified querier.

Each reply is sent as a message (%Zenohex.Sample{} or %Zenohex.Query.ReplyError{}) to pid. Unlike get/3, there is no way to know when all replies have been received; use an application-level protocol to determine when to stop waiting.

undeclare(id)

@spec undeclare(id()) :: :ok | {:error, reason :: term()}

Undeclares the querier identified by the given ID.