PacketFlow.Substrate (packetflow v0.1.0)
Dynamic substrate composition and management for PacketFlow
This module provides:
- Dynamic substrate loading
- Substrate composition patterns
- Substrate dependency resolution
- Substrate configuration
- Substrate monitoring
Summary
Functions
Add substrate dependency
Returns a specification to start this module under a supervisor.
Create a substrate composition
Get substrate health status
Get substrate information
Callback implementation for GenServer.init/1
.
List all substrates
Load a substrate composition
Register a substrate with dynamic loading capabilities
Remove substrate dependency
Unregister a substrate
Unwatch substrate
Update substrate configuration
Watch substrate for changes
Types
@type substrate_config() :: map()
@type substrate_id() :: atom()
@type substrate_info() :: %{ id: substrate_id(), module: module(), config: substrate_config(), dependencies: [substrate_id()], status: :active | :inactive | :error, load_factor: float(), last_heartbeat: integer() }
Functions
@spec add_substrate_dependency(substrate_id(), substrate_id()) :: :ok | {:error, String.t()}
Add substrate dependency
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec create_composition(String.t(), [substrate_id()], map()) :: {:ok, String.t()} | {:error, String.t()}
Create a substrate composition
@spec get_substrate_health(substrate_id()) :: map() | {:error, String.t()}
Get substrate health status
@spec get_substrate_info(substrate_id()) :: substrate_info() | nil
Get substrate information
Callback implementation for GenServer.init/1
.
@spec list_substrates() :: [substrate_id()]
List all substrates
Load a substrate composition
@spec register_substrate(substrate_id(), module(), substrate_config()) :: {:ok, substrate_info()} | {:error, String.t()}
Register a substrate with dynamic loading capabilities
@spec remove_substrate_dependency(substrate_id(), substrate_id()) :: :ok | {:error, String.t()}
Remove substrate dependency
@spec unregister_substrate(substrate_id()) :: :ok | {:error, String.t()}
Unregister a substrate
@spec unwatch_substrate(substrate_id(), pid()) :: :ok | {:error, String.t()}
Unwatch substrate
@spec update_substrate_config(substrate_id(), substrate_config()) :: :ok | {:error, String.t()}
Update substrate configuration
@spec watch_substrate(substrate_id(), pid()) :: :ok | {:error, String.t()}
Watch substrate for changes