Lightning.Adaptors.Supervisor (Lightning v2.19.0)

View Source

Supervises one instance of the adaptors subsystem: the cache, task supervisor, invalidator, node monitor, channel broadcaster and the HighlanderPG-wrapped scheduler.

Every child, cache, topic and lock name derives from the :name opt, so several instances can run in one BEAM. Production starts one under name: Lightning.Adaptors. The scheduler is a cluster singleton registered under global_scheduler_name/1.

Summary

Functions

Cachex table name for the supervisor named name.

ChannelBroadcaster GenServer name for the supervisor named name.

Returns a specification to start this module under a supervisor.

PubSub topic carrying debounced adaptors_updated events for the supervisor named name; see Lightning.Adaptors.subscribe_to_updates/1.

Starts an instance, or returns the running one. For entry points that may run either against a cold BEAM or inside the booted application.

Erases the instance's :persistent_term entry. Not called automatically, since :persistent_term.erase/1 triggers a global GC.

:global Scheduler name for the supervisor named name; pass it to GenServer.call/3 directly.

HighlanderPG supervisor name for the supervisor named name.

Invalidator GenServer name for the supervisor named name.

Postgres advisory-lock key for the supervisor named name.

NodeMonitor GenServer name for the supervisor named name.

Atom form of the Scheduler name for the supervisor named name. The process itself registers under global_scheduler_name/1.

Returns the source (:npm | :local) of the supervisor named name.

PubSub topic carrying {:changed, name, source} events for the supervisor named name.

Starts a supervisor instance.

Returns the strategy of the supervisor named name. Raises if no supervisor has started under that name.

Task.Supervisor name for the supervisor named name.

Functions

cache_name(name)

@spec cache_name(atom()) :: atom()

Cachex table name for the supervisor named name.

channel_broadcaster_name(name)

@spec channel_broadcaster_name(atom()) :: atom()

ChannelBroadcaster GenServer name for the supervisor named name.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

client_topic(name)

@spec client_topic(atom()) :: String.t()

PubSub topic carrying debounced adaptors_updated events for the supervisor named name; see Lightning.Adaptors.subscribe_to_updates/1.

ensure_started(opts \\ [])

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

Starts an instance, or returns the running one. For entry points that may run either against a cold BEAM or inside the booted application.

forget(name)

@spec forget(atom()) :: boolean()

Erases the instance's :persistent_term entry. Not called automatically, since :persistent_term.erase/1 triggers a global GC.

global_scheduler_name(name)

@spec global_scheduler_name(atom()) :: {:global, atom()}

:global Scheduler name for the supervisor named name; pass it to GenServer.call/3 directly.

highlander_name(name)

@spec highlander_name(atom()) :: atom()

HighlanderPG supervisor name for the supervisor named name.

invalidator_name(name)

@spec invalidator_name(atom()) :: atom()

Invalidator GenServer name for the supervisor named name.

lock_key(name)

@spec lock_key(atom()) :: non_neg_integer()

Postgres advisory-lock key for the supervisor named name.

node_monitor_name(name)

@spec node_monitor_name(atom()) :: atom()

NodeMonitor GenServer name for the supervisor named name.

scheduler_name(name)

@spec scheduler_name(atom()) :: atom()

Atom form of the Scheduler name for the supervisor named name. The process itself registers under global_scheduler_name/1.

source(name)

@spec source(atom()) :: :npm | :local

Returns the source (:npm | :local) of the supervisor named name.

source_topic(name)

@spec source_topic(atom()) :: String.t()

PubSub topic carrying {:changed, name, source} events for the supervisor named name.

start_link(opts)

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

Starts a supervisor instance.

Options:

strategy(name)

@spec strategy(atom()) :: module()

Returns the strategy of the supervisor named name. Raises if no supervisor has started under that name.

tasks_name(name)

@spec tasks_name(atom()) :: atom()

Task.Supervisor name for the supervisor named name.