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

Copy Markdown View Source

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

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

Functions

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

@spec declare_scout(what(), 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 or :router.
  • config: The configuration to use for scouting
  • pid: Process to receive Hello messages. Defaults to the calling process.

scout(what, config, timeout)

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

Sends scout messages and waits for Hello replies.

Parameters

  • what: :peer or :router.
  • 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.