Raxol.Core.Runtime.Plugins.PluginEventFilter.Behaviour behaviour (Raxol v0.3.0)

View Source

Defines the behaviour for plugin event filtering.

This behaviour is responsible for:

  • Filtering events through registered plugin filters
  • Managing event modifications
  • Handling event halting
  • Coordinating event propagation

Summary

Callbacks

Applies a single plugin's filter to the event.

Filters an event through registered plugin filters. Returns the filtered event or :halt if the event should be stopped.

Gets a list of enabled plugins in load order.

Handles event filtering errors.

Updates the event filter state.

Callbacks

apply_plugin_filter(plugin_id, event, state)

@callback apply_plugin_filter(
  plugin_id :: String.t(),
  event :: Raxol.Core.Runtime.Events.Event.t(),
  state :: map()
) :: {:ok, Raxol.Core.Runtime.Events.Event.t()} | :halt | {:error, any()}

Applies a single plugin's filter to the event.

filter_event(plugin_manager_state, event)

@callback filter_event(
  plugin_manager_state :: map(),
  event :: Raxol.Core.Runtime.Events.Event.t()
) :: {:ok, Raxol.Core.Runtime.Events.Event.t()} | :halt | {:error, any()}

Filters an event through registered plugin filters. Returns the filtered event or :halt if the event should be stopped.

get_enabled_plugins(state)

@callback get_enabled_plugins(state :: map()) :: [String.t()]

Gets a list of enabled plugins in load order.

handle_filter_error(plugin_id, error, event)

@callback handle_filter_error(
  plugin_id :: String.t(),
  error :: any(),
  event :: Raxol.Core.Runtime.Events.Event.t()
) :: {:ok, Raxol.Core.Runtime.Events.Event.t()} | :halt | {:error, any()}

Handles event filtering errors.

update_filter_state(state, new_state)

@callback update_filter_state(
  state :: map(),
  new_state :: map()
) :: map()

Updates the event filter state.