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

Copy Markdown View Source

Interface for querying current matching status and listening for status changes for publishers and queriers.

Matching is supported for publisher and querier entities.

Summary

Functions

Declares a matching listener for a publisher or querier.

Returns the current matching status for a publisher or querier.

Undeclares the matching listener identified by the given ID.

Types

entity_id()

@type entity_id() :: Zenohex.Publisher.id() | Zenohex.Querier.id()

listener_id()

@type listener_id() :: reference()

Functions

declare_listener(entity_id, pid \\ self())

@spec declare_listener(entity_id(), pid()) ::
  {:ok, listener_id()} | {:error, reason :: term()}

Declares a matching listener for a publisher or querier.

Status updates are delivered to pid as Zenohex.Matching.Status.t/0 messages.

Important

The returned listener_id must be held for as long as the listener is in use. If it is not held and gets garbage-collected by the BEAM, the underlying listener in Rust will be automatically dropped.

status(entity_id)

@spec status(entity_id()) :: {:ok, boolean()} | {:error, reason :: term()}

Returns the current matching status for a publisher or querier.

undeclare_listener(listener_id)

@spec undeclare_listener(listener_id()) :: :ok | {:error, reason :: term()}

Undeclares the matching listener identified by the given ID.