Ankusa.Routes.TableOwner (ankusa v0.7.0)

Copy Markdown View Source

Keeps an instance's route snapshot table alive across a routes-store restart. It creates the table and is its heir: the store writes into it (Ankusa.Routes.Snapshot asks for it with hand_over/2), and when the store dies the table comes back here instead of being deleted. The restarted store takes it over with Ankusa.Routes.Snapshot.adopt/1 and resumes from the routes in it, rather than starting again from its config.

Started by Ankusa.Instance just before the routes store; nothing else needs to call it.

Summary

Functions

Returns a specification to start this module under a supervisor.

Give the table to pid (the routes store). {:error, :not_running} when this instance has no owner process (a store started on its own, in tests).

Functions

child_spec(init_arg)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Returns a specification to start this module under a supervisor.

See Supervisor.

hand_over(instance, pid)

@spec hand_over(atom(), pid()) :: :ok | {:error, :not_running | :owned_elsewhere}

Give the table to pid (the routes store). {:error, :not_running} when this instance has no owner process (a store started on its own, in tests).

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()