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

View Source

Defines the behaviour for plugin command dispatching.

This behaviour is responsible for:

  • Dispatching commands to appropriate plugins
  • Managing command execution flow
  • Handling command results and errors
  • Coordinating command responses

Summary

Callbacks

Dispatches a command to the appropriate plugin. Returns an updated state and any necessary side effects.

Updates the command dispatcher state.

Callbacks

dispatch_command(command_atom, namespace, data, dispatcher_pid, state)

@callback dispatch_command(
  command_atom :: atom(),
  namespace :: atom(),
  data :: list(),
  dispatcher_pid :: pid(),
  state :: map()
) :: {:ok, map()} | {:error, any()}

Dispatches a command to the appropriate plugin. Returns an updated state and any necessary side effects.

handle_command_error(command_atom, error, dispatcher_pid, state)

@callback handle_command_error(
  command_atom :: atom(),
  error :: any(),
  dispatcher_pid :: pid(),
  state :: map()
) :: {:ok, map()} | {:error, any()}

Handles command errors from plugins.

handle_command_result(command_atom, result, dispatcher_pid, state)

@callback handle_command_result(
  command_atom :: atom(),
  result :: any(),
  dispatcher_pid :: pid(),
  state :: map()
) :: {:ok, map()} | {:error, any()}

Handles command results from plugins.

handle_command_timeout(command_atom, dispatcher_pid, state)

@callback handle_command_timeout(
  command_atom :: atom(),
  dispatcher_pid :: pid(),
  state :: map()
) :: {:ok, map()} | {:error, any()}

Handles command timeouts.

update_dispatcher_state(state, new_state)

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

Updates the command dispatcher state.