Ankusa.Instance.RegistryWatch (ankusa v0.7.0)

Copy Markdown View Source

Stops an instance when Ankusa.Registry restarts, so its supervisor starts it again.

Every instance process registers by name in Ankusa.Registry, and registering links it to the Registry's partition. A partition that dies takes every registrant that does not trap exits (batchers, writer, rate limiter, quarantine, the route cache…) down with it, and their supervisors restart them, registered anew once the partition is back. A registrant that traps exits (the store, every supervisor, Ankusa.Instance.Isolated) survives instead, unregistered: Ankusa.whereis/2 returns nil for it and Ankusa.via/2 calls to it fail, and nothing puts it back.

The watcher monitors the Registry supervisor and every partition under it, because a partition crash restarts the partitions while the supervisor stays up. Its own exit shuts the whole instance down: the instance's root supervisor lists it as a significant child with auto_shutdown: :any_significant, and whatever supervises the instance starts it again, every process registered in the new Registry.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(instance)