View Source Zenohex.Session (Zenohex v0.3.1)

Documentation for Elixir.Zenohex.Session.

Summary

Functions

Create a Publisher for the given key expression.

Create a PullSubscriber for the given key expression.

Create a Quaryable for the given key expression.

Create a Subscriber for the given key expression.

Get reply receiver from the matching queryables in the system.

Query data from receiver. Normally users don't need to change the default timeout_us.

Get one data from the matching queryables in the system.
To get multiple data, use get_reply_receiver/2 and get_reply_timeout/1 instead.

Types

Functions

Link to this function

declare_publisher(session, key_expr, opts \\ %Publisher.Options{})

View Source
@spec declare_publisher(t(), String.t(), Zenohex.Publisher.Options.t()) ::
  {:ok, Zenohex.Publisher.t()} | {:error, reason :: any()}

Create a Publisher for the given key expression.

Examples

iex> {:ok, session} = Zenohex.open()
iex> Zenohex.Session.declare_publisher(session, "key/expression")
Link to this function

declare_pull_subscriber(session, key_expr, opts \\ %Subscriber.Options{})

View Source
@spec declare_pull_subscriber(t(), String.t(), Zenohex.Subscriber.Options.t()) ::
  {:ok, Zenohex.PullSubscriber.t()} | {:error, reason :: any()}

Create a PullSubscriber for the given key expression.

Examples

iex> {:ok, session} = Zenohex.open()
iex> Zenohex.Session.declare_pull_subscriber(session, "key/expression")
Link to this function

declare_queryable(session, key_expr, opts \\ %Queryable.Options{})

View Source
@spec declare_queryable(t(), String.t(), Zenohex.Queryable.Options.t()) ::
  {:ok, Zenohex.Queryable.t()} | {:error, reason :: any()}

Create a Quaryable for the given key expression.

Examples

iex> {:ok, session} = Zenohex.open()
iex> Zenohex.Session.declare_queryable(session, "key/expression")
Link to this function

declare_subscriber(session, key_expr, opts \\ %Subscriber.Options{})

View Source
@spec declare_subscriber(t(), String.t(), Zenohex.Subscriber.Options.t()) ::
  {:ok, Zenohex.Subscriber.t()} | {:error, reason :: any()}

Create a Subscriber for the given key expression.

Examples

iex> {:ok, session} = Zenohex.open()
iex> Zenohex.Session.declare_subscriber(session, "key/expression")
Link to this function

delete(session, key_expr)

View Source
@spec delete(t(), String.t()) :: :ok | {:error, reason :: any()}

Delete data.

Examples

iex> {:ok, session} = Zenohex.open()
iex> Zenohex.Session.delete(session, "key/expression")
:ok
Link to this function

get_reply_receiver(session, selector, opts \\ %Query.Options{})

View Source
@spec get_reply_receiver(t(), String.t(), Zenohex.Query.Options.t()) ::
  {:ok, receiver()} | {:error, reason :: any()}

Get reply receiver from the matching queryables in the system.

Examples

iex> {:ok, session} = Zenohex.open()
iex> Zenohex.Session.get_reply_receiver(session, "key/**")
Link to this function

get_reply_timeout(receiver, timeout_us \\ 1000)

View Source
@spec get_reply_timeout(receiver(), pos_integer()) ::
  {:ok, Zenohex.Sample.t()}
  | {:error, :timeout}
  | {:error, :disconnected}
  | {:error, reason :: any()}

Query data from receiver. Normally users don't need to change the default timeout_us.

Examples

iex> {:ok, session} = Zenohex.open()
iex> {:ok, receiver} = Zenohex.Session.get_reply_receiver(session, "key/**")
iex> Zenohex.Session.get_reply_timeout(receiver)
{:error, :disconnected}
Link to this function

get_timeout(session, selector, timeout_us, opts \\ %Query.Options{})

View Source
@spec get_timeout(t(), String.t(), pos_integer(), Zenohex.Query.Options.t()) ::
  {:ok, Zenohex.Sample.t()}
  | {:error, :timeout}
  | {:error, :disconnected}
  | {:error, reason :: any()}

Get one data from the matching queryables in the system.
To get multiple data, use get_reply_receiver/2 and get_reply_timeout/1 instead.

Examples

iex> {:ok, session} = Zenohex.open()
iex> Zenohex.Session.get_timeout(session, "key/expression", 1000)
{:error, :disconnected}
Link to this function

put(session, key_expr, value)

View Source
@spec put(t(), String.t(), binary() | integer() | float()) ::
  :ok | {:error, reason :: any()}

Put data.

Examples

iex> {:ok, session} = Zenohex.open()
iex> :ok = Zenohex.Session.put(session, "key/expression", "value")
iex> :ok = Zenohex.Session.put(session, "key/expression", 0)
iex> :ok = Zenohex.Session.put(session, "key/expression", 0.0)