View Source ProcessHub.Constant.Hook (ProcessHub v0.5.0-beta)
Defines the list of hooks that can be used to extend the functionality of ProcessHub.
Summary
Functions
Hook triggered right before the supervisor starts the child process.
Hook triggered right after process has been restarted by local supervisor and the pid has been updated.
Hook triggered when a new process is registered in the ProcessHub registry.
Hook triggered when a process is unregistered from the ProcessHub registry.
Hook triggered when children are forwarded to other nodes during migration or when stop requests are redirected to the actual node hosting the child.
Hook triggered inside the coordinator terminate/2 function.
Hook dispatched when handover states have been delivered to migrated processes.
Hook triggered when the migration handler has finished processing. This does not indicate whether the migration has completed.
Hook triggered right after the children of a process are started.
Hook triggered when a new node has joined the hub cluster and after handling the node join event.
Hook triggered when a node has left the hub cluster and after handling the node leave event.
Hook triggered after processes are redistributed.
Hook triggered before redistribution of children is called.
Hook triggered before the children of a process are started.
Hook triggered when a new node has joined the hub cluster and before handling the node join event.
Hook triggered when a node has left the hub cluster and before handling the node leave event.
Hook triggered before processes are redistributed.
Hook dispatched when the centralized load balancer scoreboard is updated.
Functions
@spec child_data_alter() :: atom()
Hook triggered right before the supervisor starts the child process.
This is an alter hook used to modify child process data before it is started.
Data: map() (the child data map, returned modified)
@spec child_pid_updated() :: atom()
Hook triggered right after process has been restarted by local supervisor and the pid has been updated.
Data: %{node: node(), pid: pid()}
@spec child_registered() :: atom()
Hook triggered when a new process is registered in the ProcessHub registry.
Data: %{child_id: child_id(), node_pids: [{node(), pid()}]}
@spec child_unregistered() :: atom()
Hook triggered when a process is unregistered from the ProcessHub registry.
Data: %{child_id: child_id()}
@spec children_forwarded() :: atom()
Hook triggered when children are forwarded to other nodes during migration or when stop requests are redirected to the actual node hosting the child.
Data: %{forwards: [{node(), [map()]}]}
@spec coordinator_shutdown() :: atom()
Hook triggered inside the coordinator terminate/2 function.
Data: %{reason: any()}
Consumed by: :ch_shutdown (ConsistentHashing), :mhs_shutdown (HotSwap), :mcs_shutdown (ColdSwap)
@spec handover_delivered() :: atom()
Hook dispatched when handover states have been delivered to migrated processes.
Data: %{child_ids: [child_id()], target_node: node()}
@spec migration_completed() :: atom()
Hook triggered when the migration handler has finished processing. This does not indicate whether the migration has completed.
Data: %{nodes: [node()], child_specs: [child_spec()]}
@spec post_children_start() :: atom()
Hook triggered right after the children of a process are started.
Data: %{children: [%{child_id: cid, pid: pid, result: result, nodes: [node()], child_spec: spec, metadata: map()}]}
Consumed by: :rr_post_start (Replication strategy), :mhs_process_startups (HotSwap), :mcs_process_startups (ColdSwap)
@spec post_node_join() :: atom()
Hook triggered when a new node has joined the hub cluster and after handling the node join event.
Data: %{node: node()}
@spec post_node_leave() :: atom()
Hook triggered when a node has left the hub cluster and after handling the node leave event.
Data: %{node: node()}
@spec post_redistribution() :: atom()
Hook triggered after processes are redistributed.
Data: %{event: :node_join | :node_leave, nodes: [node()]}
@spec pre_children_redistribution() :: atom()
Hook triggered before redistribution of children is called.
This is only called with node addition or removal from the cluster.
Data: %{children: list(), event: :node_leave, node: node()}
Consumed by: :rr_post_update (Replication strategy)
@spec pre_children_start() :: atom()
Hook triggered before the children of a process are started.
Data: %{request: request, hub: hub}
Consumed by: :dg_pre_start_handler (Guided distribution strategy)
@spec pre_node_join() :: atom()
Hook triggered when a new node has joined the hub cluster and before handling the node join event.
Data: %{node: node()}
@spec pre_node_leave() :: atom()
Hook triggered when a node has left the hub cluster and before handling the node leave event.
Data: %{node: node()}
@spec pre_redistribution() :: atom()
Hook triggered before processes are redistributed.
Data: %{event: :node_join | :node_leave, nodes: [node()]}
@spec scoreboard_updated() :: atom()
Hook dispatched when the centralized load balancer scoreboard is updated.
Data: %{scoreboard: term(), node: node()}