Normandy.Agents.Turn.Supervisor.Horde (normandy v2.2.0)

View Source

Horde.DynamicSupervisor for Turn.Server processes — cluster-wide placement and supervision. Children start under the registry's :via name (atomic registration). resume_policy maps to the child restart value: :lazy → :temporary (a lost node's session is NOT redistributed; it is rebuilt on the next request), :eager → :transient (Phase 7d; redistributed on node-down).

:max_restarts / :max_seconds set the restart limit, with the same default as Normandy.Agents.Turn.Supervisor (100 in 5 seconds).

Pass the supervisor's name to start_server/2, not the pid start_link/1 returns: that pid is Horde's outer Supervisor, which would accept the session as a plain local child outside Horde's placement and supervision.

Summary

Functions

Starts the Horde supervisor (members: :auto).

Starts a Turn.Server for a session under the Horde supervisor sup (its name). server_opts are checked in the caller before Horde starts anything.

Stops the session server pid, on any node, without a restart. Returns {:error, :not_found} when the Horde supervisor sup (its name) has no such child. Used by Normandy.Agents.Turn.Session.delete/1.

Functions

start_link(opts)

@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}

Starts the Horde supervisor (members: :auto).

Options

start_server(sup, server_opts)

@spec start_server(
  term(),
  keyword()
) :: {:ok, pid()} | {:error, term()}

Starts a Turn.Server for a session under the Horde supervisor sup (its name). server_opts are checked in the caller before Horde starts anything.

Options

The options of Normandy.Agents.Turn.Server.start_link/1.

stop_server(sup, pid)

@spec stop_server(term(), pid()) :: :ok | {:error, :not_found}

Stops the session server pid, on any node, without a restart. Returns {:error, :not_found} when the Horde supervisor sup (its name) has no such child. Used by Normandy.Agents.Turn.Session.delete/1.