Raxol.Core.ErrorRecovery.DependencyGraph (Raxol v2.0.1)
View SourceManages dependency relationships between components for intelligent recovery.
This module builds and maintains a dependency graph that helps determine the optimal order for restarting components and implementing cascading failure prevention strategies.
Features
- Dependency relationship mapping
- Restart order optimization
- Circular dependency detection
- Fallback strategy configuration
- Critical path analysis
Usage
# Build dependency graph from child specs
graph = DependencyGraph.build([
{DatabaseWorker, []},
{CacheWorker, [depends_on: [:database_worker]]},
{APIWorker, [depends_on: [:cache_worker, :database_worker]]}
])
# Get restart order for a component
restart_order = DependencyGraph.get_restart_order(graph, :api_worker)
Summary
Functions
Build a dependency graph from child specifications.
Get all nodes that would be affected by the failure of a given node.
Get the dependencies for a given node.
Get the dependents (nodes that depend on this one) for a given node.
Get the fallback strategy for a node.
Get performance impact estimate for restarting a node.
Get the optimal restart order for a given node and its dependencies.
Get the restart strategy for a node.
Check if a node is on a critical path.
Determine if restarting a node would cause cascading restarts.
Types
@type node_info() :: %{ id: node_id(), module: module(), priority: integer(), critical: boolean(), fallback_strategy: fallback_strategy() }
@type restart_strategy() ::
:wait_for_dependencies
| :restart_with_dependencies
| :independent
| :graceful_degradation
Functions
Build a dependency graph from child specifications.
Get all nodes that would be affected by the failure of a given node.
Get the dependencies for a given node.
Get the dependents (nodes that depend on this one) for a given node.
Get the fallback strategy for a node.
Get performance impact estimate for restarting a node.
Get the optimal restart order for a given node and its dependencies.
Get the restart strategy for a node.
Check if a node is on a critical path.
Determine if restarting a node would cause cascading restarts.