Raxol.Swarm.CommsManager (Raxol v2.3.0)

View Source

Bandwidth-aware synchronization manager.

Monitors link quality per node and adapts sync frequency. Routes messages through priority queues, dropping low-priority traffic on degraded links. Critical messages are always sent immediately.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns all links and their quality.

Returns the current link quality for a node.

Mark a node as disconnected.

Send a message to a remote node with the given priority.

Update link quality based on health data from NodeMonitor.

Types

priority()

@type priority() :: :critical | :high | :normal | :low

t()

@type t() :: %Raxol.Swarm.CommsManager{
  flush_interval_ms: pos_integer(),
  flush_ref: reference() | nil,
  links: %{required(node()) => link_info()},
  node_monitor: GenServer.server(),
  queues: %{required(node()) => :queue.queue()}
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_all_links(server \\ __MODULE__)

@spec get_all_links(GenServer.server()) :: %{required(node()) => link_quality()}

Returns all links and their quality.

mark_disconnected(server \\ __MODULE__, node)

@spec mark_disconnected(GenServer.server(), node()) :: :ok

Mark a node as disconnected.

send_msg(server \\ __MODULE__, node, message, priority \\ :normal)

@spec send_msg(GenServer.server(), node(), term(), priority()) ::
  :ok | {:error, :disconnected}

Send a message to a remote node with the given priority.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

update_link(server \\ __MODULE__, node, rtt_ms)

@spec update_link(GenServer.server(), node(), float()) :: :ok

Update link quality based on health data from NodeMonitor.