pub struct SubgraphNode<S: State, Sub: State> {
pub subgraph: Arc<CompiledGraph<Sub>>,
pub name: String,
pub input_map: Arc<dyn Fn(&S) -> Sub + Send + Sync>,
pub output_map: Arc<dyn Fn(&Sub) -> S::Update + Send + Sync>,
pub config: SubgraphConfig,
}Expand description
Subgraph node wrapper for type erasure
When a subgraph has a different state type than its parent graph,
this wrapper handles the state transformation via input_map and output_map.
§Send API Compatibility
The Send API (dynamic fan-out) works correctly with subgraph nodes.
When multiple Send operations target the same subgraph node,
each invocation receives a unique checkpoint namespace (|name:uuid)
ensuring proper state isolation between concurrent subgraph executions.
This uniqueness is guaranteed by SubgraphPersistence::Inherit mode,
which generates a fresh UUID on every call to [compute_child_namespace].
Fields§
§subgraph: Arc<CompiledGraph<Sub>>Compiled subgraph to execute
name: StringSubgraph name for logging
input_map: Arc<dyn Fn(&S) -> Sub + Send + Sync>Transform parent state to subgraph input
output_map: Arc<dyn Fn(&Sub) -> S::Update + Send + Sync>Transform subgraph output to parent state update
config: SubgraphConfigSubgraph configuration