Raxol.Core.Runtime.Plugins.DependencyManager.Core (Raxol v0.4.0)
View SourceCore module for managing plugin dependencies and dependency resolution. Provides the main public API for dependency checking and load order resolution.
Summary
Functions
Checks if a plugin's dependencies are satisfied.
Resolves the load order for a set of plugins based on their dependencies. Uses Tarjan's algorithm for efficient cycle detection and component identification.
Types
@type dependency() :: {String.t(), version_constraint()} | String.t()
@type dependency_chain() :: [String.t()]
@type dependency_error() :: {:error, :missing_dependencies, [String.t()], dependency_chain()} | {:error, :version_mismatch, [{String.t(), String.t(), version_constraint()}], dependency_chain()} | {:error, :circular_dependency, [String.t()], dependency_chain()}
@type version_constraint() :: String.t()
Functions
Checks if a plugin's dependencies are satisfied.
Parameters
plugin_id
- The ID of the plugin to checkplugin_metadata
- The plugin's metadata containing its dependenciesloaded_plugins
- Map of currently loaded pluginsdependency_chain
- List of plugin IDs in the current dependency chain (for error reporting)
Returns
:ok
- If all dependencies are satisfied{:error, :missing_dependencies, missing, chain}
- If any dependencies are missing{:error, :version_mismatch, mismatches, chain}
- If any dependencies have incompatible versions{:error, :circular_dependency, cycle, chain}
- If a circular dependency is detected
Resolves the load order for a set of plugins based on their dependencies. Uses Tarjan's algorithm for efficient cycle detection and component identification.
Parameters
plugins
- Map of plugin metadata, keyed by plugin ID
Returns
{:ok, load_order}
- List of plugin IDs in the correct load order{:error, :circular_dependency, cycle, chain}
- If a circular dependency is detected