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

View Source

Defines the behaviour for plugin lifecycle management.

This behaviour is responsible for:

  • Loading and unloading plugins
  • Managing plugin dependencies
  • Handling plugin state transitions
  • Coordinating plugin lifecycle events

Summary

Callbacks

initialize_plugins( plugin_specs, manager_pid, plugin_registry, command_registry_table, api_version, app_config, env )

@callback initialize_plugins(
  plugin_specs :: [map()],
  manager_pid :: pid(),
  plugin_registry :: pid() | atom(),
  command_registry_table :: atom(),
  api_version :: String.t(),
  app_config :: map(),
  env :: atom()
) :: {:ok, {[map()], [map()]}} | {:error, any()}

Initializes plugins based on discovery and dependencies.

load_plugin( plugin_id_or_module, config, plugins, metadata, plugin_states, load_order, command_table, plugin_config )

@callback load_plugin(
  plugin_id_or_module :: String.t() | module(),
  config :: map(),
  plugins :: map(),
  metadata :: map(),
  plugin_states :: map(),
  load_order :: list(),
  command_table :: atom(),
  plugin_config :: map()
) :: {:ok, map()} | {:error, any()}

Loads a plugin by its ID or module.

load_plugin_by_module( plugin_module, config, plugins, metadata, plugin_states, load_order, command_table, plugin_config )

@callback load_plugin_by_module(
  plugin_module :: atom(),
  config :: map(),
  plugins :: map(),
  metadata :: map(),
  plugin_states :: map(),
  load_order :: list(),
  command_table :: atom(),
  plugin_config :: map()
) :: {:ok, map()} | {:error, any()}

Loads a plugin by its module name when the module is already known.

reload_plugin( plugin_id, plugins, metadata, plugin_states, load_order, command_table, plugin_config )

@callback reload_plugin(
  plugin_id :: String.t(),
  plugins :: map(),
  metadata :: map(),
  plugin_states :: map(),
  load_order :: list(),
  command_table :: atom(),
  plugin_config :: map()
) :: {:ok, map()} | {:error, any()}

Reloads a plugin by its ID.

reload_plugin_from_disk( plugin_id, current_state, plugin_spec, manager_pid, plugin_registry, command_registry_table, api_version, loaded_plugins_paths )

@callback reload_plugin_from_disk(
  plugin_id :: atom(),
  current_state :: map() | nil,
  plugin_spec :: map(),
  manager_pid :: pid(),
  plugin_registry :: pid() | atom(),
  command_registry_table :: atom(),
  api_version :: String.t(),
  loaded_plugins_paths :: [String.t()]
) :: {:ok, map()} | {:error, any()}

Reloads a specific plugin from disk.

unload_plugin(plugin_id, plugins, metadata, plugin_states, load_order, command_table)

@callback unload_plugin(
  plugin_id :: String.t(),
  plugins :: map(),
  metadata :: map(),
  plugin_states :: map(),
  load_order :: list(),
  command_table :: atom()
) :: {:ok, map()} | {:error, any()}

Unloads a plugin by its ID.