Zenohex.Scouting (Zenohex v0.10.0)

Copy Markdown View Source

Provides functions for Zenoh scouting, which allows discovery of peers, routers, and clients.

This module wraps Zenoh's scouting functionality, enabling Elixir programs to send scout messages, receive Hello replies, and manage periodic scouting processes.

See the Zenohex.Scouting.Hello module for details on the reply format.

Summary

Functions

Declares a scout that periodically sends scout messages and waits for Hello replies.

Sends scout messages and waits for Hello replies.

Stop scouting.

Types

scout()

@type scout() :: reference()

what()

@type what() :: :peer | :router | :client

what_matcher()

@type what_matcher() :: [what(), ...]

what_or_matcher()

@type what_or_matcher() :: what() | what_matcher()

Functions

declare_scout(what_or_matcher, config, pid \\ self())

@spec declare_scout(what_or_matcher(), Zenohex.Config.t(), pid()) ::
  {:ok, scout()} | {:error, reason :: term()}

Declares a scout that periodically sends scout messages and waits for Hello replies.

Parameters

  • what: :peer, :router, :client, or a non-empty list of these atoms.
  • config: The configuration to use for scouting
  • pid: Process to receive Hello messages. Defaults to the calling process.

scout(what_or_matcher, config, timeout)

@spec scout(what_or_matcher(), Zenohex.Config.t(), non_neg_integer()) ::
  {:ok, [Zenohex.Scouting.Hello.t()]}
  | {:error, :timeout}
  | {:error, reason :: term()}

Sends scout messages and waits for Hello replies.

A single node type or a non-empty list of node types can be specified. An empty list is rejected.

Parameters

  • what: :peer, :router, :client, or a non-empty list of these atoms.
  • config: The configuration to use for scouting
  • timeout: Timeout in milliseconds to wait for Hello replies.

stop_scout(scout)

@spec stop_scout(scout()) :: :ok | {:error, reason :: term()}

Stop scouting.