View Source ProcessHub.Service.HookManager (ProcessHub v0.1.0-alpha)
The hook manager service provides API functions for managing hook dispatching, registration, and lookup.
Summary
Functions
Returns the cache key for the hook manager.
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 sorted by hook key.
Types
Functions
@spec cache_key() :: :hooks
Returns the cache key for the hook manager.
@spec dispatch_hook(ProcessHub.hub_id() | :ets.tid(), hook_key(), any()) :: {:ok, pid()}
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()]) :: :ok | {:ok, pid()}
Dispatches multiple hooks to the registered handlers.
@spec register_handler(ProcessHub.hub_id() | :ets.tid(), hook_key(), hook()) :: true
Registers a new hook handler.
@spec registered_handlers(ProcessHub.hub_id() | :ets.tid()) :: hooks()
Returns all registered hook handlers sorted by hook key.