View Source ProcessHub.Service.HookManager (ProcessHub v0.4.0-beta)
The hook manager service provides API functions for managing hook dispatching, registration, and lookup.
Summary
Functions
Cancels a hook handler.
Executes the hook handlers and lets each handler modify the hook data.
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(:ets.tid(), hook_key(), handler_id()) :: :ok
Cancels a hook handler.
Executes the hook handlers and lets each handler modify the hook data.
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.
Works similar to dispatch_hook/3 but each handler is expected to return the modified
hook data. The hook data is passed to the next handler in the chain.
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.
Dispatches multiple hooks to the registered handlers.
Registers a new hook handler.
@spec register_handlers(:ets.tid(), hook_key(), [t()]) :: :ok | {:error, {:handler_id_not_unique, [handler_id()]}}
Registers a new hook handlers.
Returns all registered hook handlers for the given hook key