pub struct PortsOut { /* private fields */ }Expand description
Declared output ports available to a node execution boundary.
Implementations§
Source§impl PortsOut
impl PortsOut
Sourcepub fn new(port_ids: impl Into<Vec<PortId>>) -> Self
pub fn new(port_ids: impl Into<Vec<PortId>>) -> Self
Create output handles with declared port identifiers and no channels.
Sourcepub fn from_handles(
port_ids: impl Into<Vec<PortId>>,
handles: impl Into<Vec<OutputPortHandle>>,
) -> Self
pub fn from_handles( port_ids: impl Into<Vec<PortId>>, handles: impl Into<Vec<OutputPortHandle>>, ) -> Self
Create output handles from declared ports and connected channel handles.
Sourcepub fn with_metadata_sink(
self,
metadata_sink: Arc<dyn MetadataSink + Send + Sync>,
) -> Self
pub fn with_metadata_sink( self, metadata_sink: Arc<dyn MetadataSink + Send + Sync>, ) -> Self
Attach a metadata sink for send-side observations.
Sourcepub fn with_node_context(self, context: NodeContext) -> Self
pub fn with_node_context(self, context: NodeContext) -> Self
Attach node context for send-side queue observations.
Sourcepub fn with_output_validator(
self,
validator: Arc<dyn OutputPacketValidator>,
) -> Self
pub fn with_output_validator( self, validator: Arc<dyn OutputPacketValidator>, ) -> Self
Attach a validator that runs before output packets enter graph edges.
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Return whether this node currently has no declared outputs.
Sourcepub fn connected_edge_count(&self, port_id: &PortId) -> Option<usize>
pub fn connected_edge_count(&self, port_id: &PortId) -> Option<usize>
Number of connected downstream edges for a declared output port.
Sourcepub fn capacity(&self, port_id: &PortId) -> Option<usize>
pub fn capacity(&self, port_id: &PortId) -> Option<usize>
Capacity of the first connected downstream edge for a declared output port.
Sourcepub fn try_send(
&self,
port_id: &PortId,
packet: PortPacket,
) -> Result<(), PortSendError>
pub fn try_send( &self, port_id: &PortId, packet: PortPacket, ) -> Result<(), PortSendError>
Try to send one packet through a declared output port without blocking.
Unconnected declared output ports accept and drop packets. That keeps early scaffold nodes simple while later beads define explicit fan-out and disconnected-edge policy. Connected sends reserve capacity before committing the packet, so cancellation or drop between those phases releases the reserved slots instead of creating partial messages.
§Errors
Returns an error if the port is undeclared, a downstream receiver has disconnected, or a bounded downstream edge is full.
Sourcepub async fn send(
&self,
port_id: &PortId,
packet: PortPacket,
cancellation: &CancellationToken,
) -> Result<(), PortSendError>
pub async fn send( &self, port_id: &PortId, packet: PortPacket, cancellation: &CancellationToken, ) -> Result<(), PortSendError>
Send one packet through a declared output port, waiting asynchronously for bounded downstream capacity.
§Errors
Returns an error if the port is undeclared, a downstream receiver has disconnected, or cancellation is observed.
Sourcepub fn try_reserve(
&self,
port_id: &PortId,
) -> Result<PortSendPermit<'_>, PortSendError>
pub fn try_reserve( &self, port_id: &PortId, ) -> Result<PortSendPermit<'_>, PortSendError>
Try to reserve output capacity without committing a packet.
Dropping the returned permit releases all reserved downstream slots.
§Errors
Returns an error if the port is undeclared, a downstream receiver has disconnected, or a bounded downstream edge is full.
Sourcepub async fn reserve(
&self,
port_id: &PortId,
cancellation: &CancellationToken,
) -> Result<PortSendPermit<'_>, PortSendError>
pub async fn reserve( &self, port_id: &PortId, cancellation: &CancellationToken, ) -> Result<PortSendPermit<'_>, PortSendError>
Reserve output capacity asynchronously without committing a packet.
Dropping the returned permit releases all reserved downstream slots.
§Errors
Returns an error if the port is undeclared, a downstream receiver has disconnected, or cancellation is observed.