View Source ProcessHub.Service.Distributor (ProcessHub v0.2.0-alpha)

The distributor service provides API functions for distributing child processes.

Summary

Functions

Terminates child process locally and propagates all nodes in the cluster to remove the child process from their registry.

Initiates processes startup.

Initiates processes shutdown.

Return a list of all child processes started by all nodes in the cluster.

Returns all child processes started by the local node.

Functions

Link to this function

child_terminate(hub_id, child_id, sync_strategy)

View Source
@spec child_terminate(
  ProcessHub.hub_id(),
  ProcessHub.child_id(),
  ProcessHub.Strategy.Synchronization.Base
) :: :ok | {:error, :not_found | :restarting | :running}

Terminates child process locally and propagates all nodes in the cluster to remove the child process from their registry.

Link to this function

children_redist_init(hub_id, child_specs, node, opts \\ [])

View Source
@spec children_redist_init(
  ProcessHub.hub_id(),
  [ProcessHub.child_spec()],
  node(),
  keyword() | nil
) :: {:ok, :redistribution_initiated} | {:ok, :no_children_to_redistribute}

Initiates process redistribution.

Link to this function

init_children(hub_id, child_specs, opts)

View Source
@spec init_children(ProcessHub.hub_id(), [ProcessHub.child_spec()], keyword()) ::
  {:ok, :start_initiated}
  | (-> {:ok, list()})
  | {:error,
     :child_start_timeout
     | :no_children
     | {:already_started, [ProcessHub.child_id()]}
     | any()}

Initiates processes startup.

Link to this function

stop_children(hub_id, child_ids, opts)

View Source
@spec stop_children(ProcessHub.hub_id(), [ProcessHub.child_id()], keyword()) ::
  (-> {:error, list()} | {:ok, list()}) | {:ok, :stop_initiated}

Initiates processes shutdown.

Link to this function

which_children_global(hub_id, opts)

View Source
@spec which_children_global(
  ProcessHub.hub_id(),
  keyword()
) :: list()

Return a list of all child processes started by all nodes in the cluster.

Link to this function

which_children_local(hub_id, opts)

View Source
@spec which_children_local(ProcessHub.hub_id(), keyword() | nil) ::
  {node(),
   [
     {any(), :restarting | :undefined | pid(), :supervisor | :worker,
      :dynamic | list()}
   ]}

Returns all child processes started by the local node.

Works similar to Supervisor.which_children/1 but returns a list of tuple where the first element is the node name and the second child processes started under the node.