PacketFlow.Component.Interface behaviour (packetflow v0.1.0)
Standard interfaces for PacketFlow components
This module defines the core interfaces that all PacketFlow components should implement to ensure consistent behavior and interoperability.
Summary
Callbacks
Component initialization interface (use component-specific init functions to avoid GenServer conflicts)
Component configuration interface - get configuration
Component dependency interface - get dependencies
Component monitoring interface - get metrics
Component capability interface - get provided capabilities
Component capability interface - get required capabilities
Component state interface - get current state
Component communication interface - handle message
Component monitoring interface - health check
Component communication interface - send message
Component lifecycle interface - start component
Component lifecycle interface - stop component
Component configuration interface - update configuration
Component state interface - update state
Component dependency interface - validate dependencies
Functions
Macro to implement standard component interface behaviors
Get component interface metadata
Validate that a module implements the component interface
Callbacks
Component initialization interface (use component-specific init functions to avoid GenServer conflicts)
@callback get_config() :: map()
Component configuration interface - get configuration
@callback get_dependencies() :: [atom()]
Component dependency interface - get dependencies
@callback get_metrics() :: map()
Component monitoring interface - get metrics
@callback get_provided_capabilities() :: [term()]
Component capability interface - get provided capabilities
@callback get_required_capabilities() :: [term()]
Component capability interface - get required capabilities
@callback get_state() :: term()
Component state interface - get current state
@callback handle_message(message :: term(), state :: term()) :: {:ok, new_state :: term()} | {:ok, new_state :: term(), reply :: term()} | {:error, reason :: term()}
Component communication interface - handle message
@callback health_check() :: :healthy | :unhealthy | :degraded
Component monitoring interface - health check
Component communication interface - send message
Component lifecycle interface - start component
@callback stop_component() :: :ok | {:error, reason :: term()}
Component lifecycle interface - stop component
Component configuration interface - update configuration
Component state interface - update state
@callback validate_dependencies() :: :ok | {:error, [atom()]}
Component dependency interface - validate dependencies