pub struct EventTransmitter { /* private fields */ }Expand description
Event transmitter with bandwidth control
Manages event queues with:
- Weighted fair queuing for priority levels
- Token bucket rate limiting
- Queue overflow handling
Implementations§
Source§impl EventTransmitter
impl EventTransmitter
Sourcepub fn new(allocation: BandwidthAllocation) -> Self
pub fn new(allocation: BandwidthAllocation) -> Self
Create a new event transmitter
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default allocation
Sourcepub fn set_max_queue_size(&mut self, priority: EventPriority, size: usize)
pub fn set_max_queue_size(&mut self, priority: EventPriority, size: usize)
Set maximum queue size for a priority
Sourcepub fn set_overflow_policy(&mut self, policy: OverflowPolicy)
pub fn set_overflow_policy(&mut self, policy: OverflowPolicy)
Set overflow policy
Sourcepub fn enqueue(&mut self, event: PeatEvent) -> bool
pub fn enqueue(&mut self, event: PeatEvent) -> bool
Enqueue an event for transmission
Returns true if event was accepted, false if dropped due to overflow.
Sourcepub fn transmit(&mut self, max_events: usize) -> Vec<PeatEvent>
pub fn transmit(&mut self, max_events: usize) -> Vec<PeatEvent>
Transmit events within bandwidth limits
Returns events ready for transmission, respecting bandwidth allocation.
Sourcepub fn transmit_critical(&mut self) -> Vec<PeatEvent>
pub fn transmit_critical(&mut self) -> Vec<PeatEvent>
Transmit all critical events immediately (preempt)
Sourcepub fn has_critical(&self) -> bool
pub fn has_critical(&self) -> bool
Check if there are critical events pending
Sourcepub fn queue_lengths(&self) -> [usize; 4]
pub fn queue_lengths(&self) -> [usize; 4]
Get queue lengths
Sourcepub fn total_queued(&self) -> usize
pub fn total_queued(&self) -> usize
Get total queued events
Sourcepub fn stats(&self) -> &TransmitterStats
pub fn stats(&self) -> &TransmitterStats
Get transmission statistics
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Reset statistics
Sourcepub fn available_bandwidth(&mut self) -> [f64; 4]
pub fn available_bandwidth(&mut self) -> [f64; 4]
Get available bandwidth tokens per priority
Auto Trait Implementations§
impl Freeze for EventTransmitter
impl RefUnwindSafe for EventTransmitter
impl Send for EventTransmitter
impl Sync for EventTransmitter
impl Unpin for EventTransmitter
impl UnsafeUnpin for EventTransmitter
impl UnwindSafe for EventTransmitter
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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