View Source ProcessHub.Service.HookManager (ProcessHub v0.2.0-alpha)
The hook manager service provides API functions for managing hook dispatching, registration, and lookup.
Summary
Functions
Dispatches the hook to the registered handlers and passes the hook data as an argument.
Dispatches multiple hooks to the registered handlers.
Registers a new hook handler.
Returns all registered hook handlers for the given hook key
Types
@type hook_handlers() :: %{required(hook_key()) => [hook_handler()]}
@type hook_key() ::
:pre_cluster_join_hook
| :post_cluster_join_hook
| :pre_cluster_leave_hook
| :post_cluster_leave_hook
| :registry_pid_insert_hook
| :registry_pid_remove_hook
| :children_migrated_hook
| :forwarded_migration_hook
| :priority_state_updated_hook
| :pre_nodes_redistribution_hook
| :post_nodes_redistribution_hook
| :pre_children_start_hook
Functions
@spec dispatch_hook(ProcessHub.hub_id(), hook_key(), any()) :: :ok
Dispatches the hook to the registered handlers and passes the hook data as an argument.
It is possible to register a hook handler with a wildcard argument :_
which
will be replaced with the hook data when the hook is dispatched.
@spec dispatch_hooks(ProcessHub.hub_id(), [hook_handler()]) :: :ok
Dispatches multiple hooks to the registered handlers.
@spec register_hook_handlers(ProcessHub.hub_id(), hook_key(), [hook_handler()]) :: {atom(), boolean()}
Registers a new hook handler.
@spec registered_handlers(ProcessHub.hub_id(), hook_key()) :: [hook_handler()]
Returns all registered hook handlers for the given hook key