A registrar shared by the nodes of a Malla cluster: every node running the service has all the registrations, so any of them can find the contacts of a user.
defmodule MyRegistrar do
use Malla.Service,
global: true,
plugins: [Caracola.Registrar.Cluster],
sip: [listen: "sip:all:5060"]
endThe service must be global: true, so that its nodes find each other
(see Malla.Node.get_nodes/1). The plugin implements
sip_registrar_store/2 of Caracola.Registrar:
- Reads are local.
- Each change of the contacts of an AOR is written locally and sent to the other connected nodes, which apply it if they run the service and it is newer than the one they have (the last write wins, by its time). Removed AORs are kept for a while without contacts, so that older changes arriving later do not bring them back.
- When a node starts, and every
:sync_intervalmilliseconds, it merges the registrations of another node, so nodes that were disconnected (or missed changes) converge.
Node clocks must be synchronized (as with NTP), as expirations and versions are times.
Contacts registered through a connection (with Caracola.Outbound, or
behind an edge proxy with Path) are reached through the node or proxy
that has it: their Path points to it, and the other nodes send the
requests there.
Configuration
Under the :registrar_cluster key:
:sync_interval- milliseconds between syncs (default 60000).
Summary
Functions
Merges the registrations of another node of the service (any of them if
node is nil). Returns the node, or :no_nodes.