pub struct NodeIo<'a> { /* private fields */ }Expand description
Minimal node I/O surface backed by executor queues.
use daedalus_runtime::io::NodeIo;
use daedalus_runtime::executor::EdgePayload;
fn handler(io: &mut NodeIo) {
io.push_output(Some("out"), EdgePayload::Unit);
}Implementations§
Source§impl<'a> NodeIo<'a>
impl<'a> NodeIo<'a>
Sourcepub fn new(
incoming_edges: Vec<usize>,
outgoing_edges: Vec<usize>,
queues: &'a Arc<Vec<EdgeStorage>>,
warnings_seen: &'a Arc<Mutex<HashSet<String>>>,
edges: &'a [(NodeRef, String, NodeRef, String, EdgePolicyKind)],
sync_groups: Vec<SyncGroup>,
seg_idx: usize,
node_idx: usize,
node_id: String,
telemetry: &'a mut ExecutionTelemetry,
backpressure: BackpressureStrategy,
const_inputs: &[(String, Value)],
const_coercers: Option<ConstCoercerMap>,
output_movers: Option<OutputMoverMap>,
) -> Self
pub fn new( incoming_edges: Vec<usize>, outgoing_edges: Vec<usize>, queues: &'a Arc<Vec<EdgeStorage>>, warnings_seen: &'a Arc<Mutex<HashSet<String>>>, edges: &'a [(NodeRef, String, NodeRef, String, EdgePolicyKind)], sync_groups: Vec<SyncGroup>, seg_idx: usize, node_idx: usize, node_id: String, telemetry: &'a mut ExecutionTelemetry, backpressure: BackpressureStrategy, const_inputs: &[(String, Value)], const_coercers: Option<ConstCoercerMap>, output_movers: Option<OutputMoverMap>, ) -> Self
Construct the I/O facade for a node (internal runtime API).
Sourcepub fn inputs(&self) -> &[(String, CorrelatedPayload)]
pub fn inputs(&self) -> &[(String, CorrelatedPayload)]
Returns the consumed inputs for this node. Borrow the drained inputs.
use daedalus_runtime::io::NodeIo;
fn handler(io: &NodeIo) {
let _ = io.inputs();
}Sourcepub fn has_incoming_edges(&self) -> bool
pub fn has_incoming_edges(&self) -> bool
Whether this node has any incoming edges.
Sourcepub fn sync_groups(&self) -> &[SyncGroup]
pub fn sync_groups(&self) -> &[SyncGroup]
Returns sync groups metadata for this node. Return sync group metadata.
use daedalus_runtime::io::NodeIo;
fn handler(io: &NodeIo) {
let _ = io.sync_groups();
}Sourcepub fn push_output(&mut self, port: Option<&str>, payload: EdgePayload)
pub fn push_output(&mut self, port: Option<&str>, payload: EdgePayload)
Push a payload to all outgoing edges (fan-out). Optionally filter by port. Push a prepared payload to an output port.
use daedalus_runtime::io::NodeIo;
use daedalus_runtime::executor::EdgePayload;
fn handler(io: &mut NodeIo) {
io.push_output(Some("out"), EdgePayload::Unit);
}Push a pre-correlated payload (used by host-bridge style nodes).
pub fn push_any<T: Any + Send + Sync + 'static>( &mut self, port: Option<&str>, value: T, )
pub fn push_typed<T>(&mut self, port: Option<&str>, value: T)
Sourcepub fn push_value(&mut self, port: Option<&str>, value: Value)
pub fn push_value(&mut self, port: Option<&str>, value: Value)
Push a Value payload to an output port.
use daedalus_runtime::io::NodeIo;
use daedalus_data::model::Value;
fn handler(io: &mut NodeIo) {
io.push_value(Some("out"), Value::Int(1));
}Sourcepub fn inputs_for<'b>(
&'b self,
port: &str,
) -> impl Iterator<Item = &'b CorrelatedPayload>
pub fn inputs_for<'b>( &'b self, port: &str, ) -> impl Iterator<Item = &'b CorrelatedPayload>
Iterate all inputs for a given port name. Iterate inputs for a named port.
use daedalus_runtime::io::NodeIo;
fn handler(io: &NodeIo) {
for _payload in io.inputs_for("in") {}
}Sourcepub fn get_any<T: Any + Clone + Send + Sync>(&self, port: &str) -> Option<T>
pub fn get_any<T: Any + Clone + Send + Sync>(&self, port: &str) -> Option<T>
Typed accessor for Any payloads.
Sourcepub fn get_any_ref<T: Any + Send + Sync>(&self, port: &str) -> Option<&T>
pub fn get_any_ref<T: Any + Send + Sync>(&self, port: &str) -> Option<&T>
Borrow a typed Any payload without cloning.
Sourcepub fn get_typed_ref<T>(&self, port: &str) -> Option<&T>
pub fn get_typed_ref<T>(&self, port: &str) -> Option<&T>
Borrow a typed input with constant coercion support.
Sourcepub fn get_any_mut<T>(&mut self, port: &str) -> Option<T>
pub fn get_any_mut<T>(&mut self, port: &str) -> Option<T>
Move a typed Any payload, cloning only when shared.
Sourcepub fn get_typed_mut<T>(&mut self, port: &str) -> Option<T>
pub fn get_typed_mut<T>(&mut self, port: &str) -> Option<T>
Move a typed input with constant coercion support, cloning only when shared.
Sourcepub fn get_any_all<T: Any + Clone + Send + Sync>(&self, port: &str) -> Vec<T>
pub fn get_any_all<T: Any + Clone + Send + Sync>(&self, port: &str) -> Vec<T>
Collect all typed Any payloads for a port (in arrival order).
Sourcepub fn get_any_all_fanin<T: Any + Clone + Send + Sync>(
&self,
prefix: &str,
) -> Vec<T>
pub fn get_any_all_fanin<T: Any + Clone + Send + Sync>( &self, prefix: &str, ) -> Vec<T>
Collect typed Any payloads for indexed fan-in ports {prefix}{N} ordered by N.
Example: prefix="in" collects from in0, in1, … in numeric order.
Sourcepub fn get_any_all_fanin_indexed<T: Any + Clone + Send + Sync>(
&self,
prefix: &str,
) -> Vec<(u32, T)>
pub fn get_any_all_fanin_indexed<T: Any + Clone + Send + Sync>( &self, prefix: &str, ) -> Vec<(u32, T)>
Collect typed Any payloads for indexed fan-in ports {prefix}{N} ordered by N,
preserving the parsed index.
Sourcepub fn get_typed<T>(&self, port: &str) -> Option<T>
pub fn get_typed<T>(&self, port: &str) -> Option<T>
Best-effort typed accessor that supports constant defaults.
Daedalus graph JSON encodes constant inputs as daedalus_data::model::Value. At runtime we
inject these into the node as Any payloads (e.g. i64, f64, bool, String, or
Value). This helper bridges the gap so node handlers can request their native types
(e.g. u32, f32, enums) without failing a TypeId downcast.
This is intended for scalar/enum config inputs, not large payload types (e.g. image buffers).
Sourcepub fn get_any_raw(&self, port: &str) -> Option<&dyn Any>
pub fn get_any_raw(&self, port: &str) -> Option<&dyn Any>
Get a raw Any reference for capability-based dispatch.
Sourcepub fn get_value(&self, port: &str) -> Option<&Value>
pub fn get_value(&self, port: &str) -> Option<&Value>
Convenience accessor for value payloads.
Get a structured Value payload for a port.
use daedalus_runtime::io::NodeIo;
fn handler(io: &NodeIo) {
let _ = io.get_value("in");
}pub fn get_int(&self, port: &str) -> Option<i64>
pub fn get_float(&self, port: &str) -> Option<f64>
Sourcepub fn inputs_grouped(&self) -> Vec<(String, Vec<&CorrelatedPayload>)>
pub fn inputs_grouped(&self) -> Vec<(String, Vec<&CorrelatedPayload>)>
Group inputs by port name (preserves encounter order per port).
Sourcepub fn flush(&mut self) -> Result<(), ExecuteError>
pub fn flush(&mut self) -> Result<(), ExecuteError>
Flush is a no-op now since we apply immediately; kept for symmetry.
Auto Trait Implementations§
impl<'a> !Freeze for NodeIo<'a>
impl<'a> !RefUnwindSafe for NodeIo<'a>
impl<'a> Send for NodeIo<'a>
impl<'a> !Sync for NodeIo<'a>
impl<'a> Unpin for NodeIo<'a>
impl<'a> !UnwindSafe for NodeIo<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more