AshDispatch.Notifier.Info (AshDispatch v0.5.0)
View SourceSpark Info module — reads per-action AshDispatch config persisted by the resource transformers.
Mirrors Ash.Notifier.PubSub.Info's pattern: a thin Info module that
the notifier consults at runtime to find per-action config. The
config is persisted into dsl_state by
AshDispatch.Resource.Transformers.InjectDispatchChanges (events)
and AshDispatch.Resource.Transformers.InjectCounterBroadcasts
(counters), then read back via Spark.Dsl.Extension.get_persisted/3.
Persisted keys
:ash_dispatch_dispatch_events—%{action_name => [event_config, ...]}:ash_dispatch_counter_broadcasts—%{action_name => [counter_config, ...]}
Both keys default to %{} when absent (resource without dispatch
events / counters), and per-action lookups default to [].
Summary
Types
Per-action counter-config list — one entry per counter ... do ... end block targeting the action.
Per-action event-config list — one entry per event ... do ... end block targeting the action.
Functions
Full counter-broadcasts map for resource keyed by action name.
Full dispatch-events map for resource keyed by action name. Useful
for introspection / admin tooling.
All counter broadcasts triggered by action_name on resource.
Returns [] when none are registered.
All dispatch events triggered by action_name on resource.
Returns [] when none are registered.
Types
@type counter_config() :: %{ :counter_name => atom(), :resource => module(), :query_filter => term(), :audience => atom(), :invalidates => list(), optional(any()) => any() }
Per-action counter-config list — one entry per counter ... do ... end block targeting the action.
Per-action event-config list — one entry per event ... do ... end block targeting the action.
Functions
@spec all_counter_broadcasts(module()) :: %{required(atom()) => [counter_config()]}
Full counter-broadcasts map for resource keyed by action name.
@spec all_dispatch_events(module()) :: %{required(atom()) => [event_config()]}
Full dispatch-events map for resource keyed by action name. Useful
for introspection / admin tooling.
@spec counter_broadcasts_for(module(), atom()) :: [counter_config()]
All counter broadcasts triggered by action_name on resource.
Returns [] when none are registered.
@spec dispatch_events_for(module(), atom()) :: [event_config()]
All dispatch events triggered by action_name on resource.
Returns [] when none are registered.