pub struct FlowContext {
pub event: FrameworkEvent,
pub variables: HashMap<String, Value>,
pub link_service: Arc<dyn LinkService>,
pub entity_fetchers: HashMap<String, Arc<dyn EntityFetcher>>,
pub sink_registry: Option<Arc<SinkRegistry>>,
}Expand description
Context passed through each operator in the pipeline
Accumulates variables as operators resolve entities and fan out.
Each operator can read/write variables via get_var/set_var.
§Variables
Variables are stored as serde_json::Value and named by the as field
of operators. For example, resolve(from: source_id, as: follower) stores
the resolved entity as follower in the context.
Special variables set from the trigger event:
source_id— Source entity ID (for link events)target_id— Target entity ID (for link events)link_type— Link type (for link events)entity_type— Entity type (for entity events)entity_id— Entity ID (for entity events)metadata— Link metadata (for link events)data— Entity data (for entity events)
Fields§
§event: FrameworkEventThe original framework event that triggered this flow
variables: HashMap<String, Value>Accumulated variables from pipeline operators
link_service: Arc<dyn LinkService>Access to the link service for resolve/fan_out operators
entity_fetchers: HashMap<String, Arc<dyn EntityFetcher>>Access to entity fetchers, keyed by entity type
sink_registry: Option<Arc<SinkRegistry>>Access to the sink registry for deliver operators
Implementations§
Source§impl FlowContext
impl FlowContext
Sourcepub fn new(
event: FrameworkEvent,
link_service: Arc<dyn LinkService>,
entity_fetchers: HashMap<String, Arc<dyn EntityFetcher>>,
) -> Self
pub fn new( event: FrameworkEvent, link_service: Arc<dyn LinkService>, entity_fetchers: HashMap<String, Arc<dyn EntityFetcher>>, ) -> Self
Create a new FlowContext from a framework event
Automatically extracts event fields into variables.
Sourcepub fn with_sink_registry(self, registry: Arc<SinkRegistry>) -> Self
pub fn with_sink_registry(self, registry: Arc<SinkRegistry>) -> Self
Set the sink registry for deliver operators
Sourcepub fn get_var_str(&self, name: &str) -> Option<&str>
pub fn get_var_str(&self, name: &str) -> Option<&str>
Get a variable as a string (convenience)
Trait Implementations§
Source§impl Clone for FlowContext
impl Clone for FlowContext
Source§fn clone(&self) -> FlowContext
fn clone(&self) -> FlowContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more