pub trait NodeObserver: Send + Sync {
// Required methods
fn on_node_start(
&self,
node_name: &str,
step: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
fn on_node_complete(
&self,
node_name: &str,
step: u32,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
fn on_node_error(
&self,
node_name: &str,
step: u32,
error: &str,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
// Provided method
fn on_node_retry(
&self,
_node_name: &str,
_step: u32,
_attempt: u32,
_max_attempts: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>> { ... }
}Expand description
Observer for node lifecycle events within the execution engine.
pe-graph calls these methods around each node execution. pe-runtime
provides a streaming implementation that converts them to StreamEvent.
This is the extension point for phase-aware visibility. Without an observer, no overhead — the engine just skips the calls.
§Async note
Returns boxed futures because async trait methods are not yet stable in all contexts. Implementations should be lightweight (just send to a channel).
Required Methods§
Sourcefn on_node_start(
&self,
node_name: &str,
step: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn on_node_start( &self, node_name: &str, step: u32, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Called before a node starts executing.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".