View Source ProcessHub.Service.HookManager (ProcessHub v0.3.2-alpha)
The hook manager service provides API functions for managing hook dispatching, registration, and lookup.
Summary
Functions
Cancels a hook handler.
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.
Registers a new hook handlers.
Returns all registered hook handlers for the given hook key
Types
@type handler_priority() :: integer()
@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
| :post_children_start_hook
| :pre_children_redistribution_hook
| :coordinator_shutdown_hook
| :process_startups_hook
@type t() :: %ProcessHub.Service.HookManager{ a: [any()], f: atom(), id: handler_id(), m: module(), p: handler_priority() | nil }
Functions
@spec cancel_handler(ProcessHub.hub_id(), hook_key(), handler_id()) :: :ok
Cancels a hook handler.
@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(), [t()]) :: :ok
Dispatches multiple hooks to the registered handlers.
@spec register_handler(ProcessHub.hub_id(), hook_key(), t()) :: :ok | {:error, :handler_id_not_unique}
Registers a new hook handler.
@spec register_handlers(ProcessHub.hub_id(), hook_key(), [t()]) :: :ok | {:error, {:handler_id_not_unique, [handler_id()]}}
Registers a new hook handlers.
@spec registered_handlers(ProcessHub.hub_id(), hook_key()) :: [t()]
Returns all registered hook handlers for the given hook key