Parrhesia.API.Sync
(parrhesia v0.12.0)
Copy Markdown
Sync server control-plane API.
This module manages outbound relay sync definitions and exposes runtime status for each configured sync worker.
The main entrypoint is put_server/2. Accepted server maps are normalized into a stable
internal shape and persisted by the sync manager. The expected input shape is:
%{
"id" => "tribes-primary",
"url" => "wss://relay-a.example/relay",
"enabled?" => true,
"auth_pubkey" => "...64 hex chars...",
"filters" => [%{"kinds" => [5000]}],
"mode" => "req_stream",
"overlap_window_seconds" => 300,
"relay_info_mode" => "required",
"auth" => %{"type" => "nip42", "mode" => "on_challenge"},
"tls" => %{
"mode" => "required",
"hostname" => "relay-a.example",
"ca_certfile" => "/etc/tribes/cluster-ca.pem",
"client_certfile" => "/etc/tribes/node.crt",
"client_keyfile" => "/etc/tribes/node.key",
"pins" => [%{"type" => "spki_sha256", "value" => "..."}]
},
"metadata" => %{}
}Most functions accept :manager or :name in opts to target a non-default manager.
Summary
Functions
Fetches a single normalized sync server definition.
Lists all configured sync servers, including their runtime state.
Creates or replaces a sync server definition.
Removes a stored sync server definition and stops its worker if it is running.
Returns runtime counters and timestamps for a single sync server.
Marks a sync server as running and reconciles its worker state.
Stops a sync server and records a disconnect timestamp in runtime state.
Returns a health summary for the sync subsystem.
Triggers an immediate sync run for a server.
Returns aggregate counters across all configured sync servers.
Types
@type server() :: map()
Normalized sync server configuration returned by the sync manager.
Functions
Fetches a single normalized sync server definition.
Returns :error when the server id is unknown.
Lists all configured sync servers, including their runtime state.
Creates or replaces a sync server definition.
Removes a stored sync server definition and stops its worker if it is running.
Returns runtime counters and timestamps for a single sync server.
Returns :error when the server id is unknown.
Marks a sync server as running and reconciles its worker state.
Stops a sync server and records a disconnect timestamp in runtime state.
Returns a health summary for the sync subsystem.
Triggers an immediate sync run for a server.
Returns aggregate counters across all configured sync servers.