pub struct DataFlowController {
pub buffers: Vec<PortBuffer>,
pub policy: BackpressurePolicy,
}Expand description
Coordinates all port buffers in the graph and enforces backpressure.
Fields§
§buffers: Vec<PortBuffer>All port buffers managed by this controller.
policy: BackpressurePolicyBackpressure strategy applied to full buffers.
Implementations§
Source§impl DataFlowController
impl DataFlowController
Sourcepub fn new(policy: BackpressurePolicy) -> Self
pub fn new(policy: BackpressurePolicy) -> Self
Creates a new controller with no buffers and the given policy.
Sourcepub fn add_buffer(&mut self, buffer: PortBuffer)
pub fn add_buffer(&mut self, buffer: PortBuffer)
Adds a new buffer to this controller.
Sourcepub fn get_buffer(&mut self, node_id: u64, port: u32) -> Option<&mut PortBuffer>
pub fn get_buffer(&mut self, node_id: u64, port: u32) -> Option<&mut PortBuffer>
Returns a mutable reference to the buffer for (node_id, port).
Sourcepub fn total_packets_in_flight(&self) -> usize
pub fn total_packets_in_flight(&self) -> usize
Returns the total number of packets currently held across all buffers.
Sourcepub fn clear_buffer(&mut self, node_id: u64, port: u32) -> bool
pub fn clear_buffer(&mut self, node_id: u64, port: u32) -> bool
Drains the buffer for (node_id, port). Returns true if the buffer
existed (it may have already been empty).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataFlowController
impl RefUnwindSafe for DataFlowController
impl Send for DataFlowController
impl Sync for DataFlowController
impl Unpin for DataFlowController
impl UnsafeUnpin for DataFlowController
impl UnwindSafe for DataFlowController
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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