Normandy.Behaviours.SessionRegistry.Horde (normandy v1.0.0)

View Source

Distributed SessionRegistry over Horde.Registry (keys: :unique, members: :auto). The handle is the registry's name (an atom). Cluster-wide whereis; registration is atomic when servers start under the :via name from child_name/2. Works as a cluster-of-one on a single node (and on nonode@nohost) with the same config that serves N nodes.

Summary

Functions

Via-name for an atomic, supervisor-driven start (see SessionRegistry.child_name/2).

Convenience for tests: start a uniquely-named registry and return its name.

Start a unique Horde.Registry. :name defaults to this module.

Functions

child_name(handle, session_id)

Via-name for an atomic, supervisor-driven start (see SessionRegistry.child_name/2).

new(opts \\ [])

@spec new(keyword()) :: atom()

Convenience for tests: start a uniquely-named registry and return its name.

Waits until the registry actually accepts a registration before returning. A fresh members: :auto registry transiently rejects registrations (and :via starts) with :process_not_registered_via until it converges; gating here keeps test setup from racing that window. Production starts the registry in a supervision tree (it is ready long before any session), so this gate is new/1 only.

start_link(opts \\ [])

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

Start a unique Horde.Registry. :name defaults to this module.