Raxol.Core.Runtime.Plugins.LifecycleHelper.Behaviour behaviour (Raxol v0.4.0)
View SourceDefines 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
Cleans up a plugin with the given plugin_id and state.
Handles a state transition for a plugin.
Initializes a plugin with the given module and options.
Initializes plugins based on discovery and dependencies.
Loads a plugin by its ID or module.
Loads a plugin by its module name when the module is already known.
Reloads a plugin by its ID.
Reloads a specific plugin from disk.
Terminates a plugin with the given plugin_id, state, and reason.
Unloads a plugin by its ID.
Callbacks
Cleans up a plugin with the given plugin_id and state.
@callback handle_state_transition( plugin_id :: any(), transition :: any(), state :: map() ) :: {:ok, map()} | {:error, any()}
Handles a state transition for a plugin.
Initializes a plugin with the given module and options.
@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.
@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.
@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.
@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.
@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.
@callback terminate_plugin( plugin_id :: any(), state :: map(), reason :: any() ) :: :ok | {:error, any()}
Terminates a plugin with the given plugin_id, state, and reason.
@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.