pub struct TopicSlot { /* private fields */ }Expand description
Shared, type-erased FIFO slot that connects a [BasicPublisher] to one or
more [BasicSubscriber]s on the same topic within a single process.
Implementations§
Source§impl TopicSlot
impl TopicSlot
pub fn new(max_depth: usize) -> Self
pub fn new_with_reliability_policy( max_depth: usize, reliability_policy: TopicReliabilityPolicy, ) -> Self
pub fn set_reliability_policy(&self, reliability_policy: TopicReliabilityPolicy)
Sourcepub fn push(&self, msg: Box<dyn Any + Send>) -> bool
pub fn push(&self, msg: Box<dyn Any + Send>) -> bool
Push a message into the slot. Returns true when the slot was already
at capacity (backpressure) and the message is not enqueued.
Sourcepub fn push_best_effort(&self, msg: Box<dyn Any + Send>) -> bool
pub fn push_best_effort(&self, msg: Box<dyn Any + Send>) -> bool
Push a message in best-effort mode.
When full, the oldest queued item is dropped to make room so publishers are not globally blocked by queue capacity.
Sourcepub fn push_batch<I>(&self, msgs: I) -> usize
pub fn push_batch<I>(&self, msgs: I) -> usize
Push a batch of messages and return the number accepted before reaching capacity.
Sourcepub fn push_batch_best_effort<I>(&self, msgs: I) -> usize
pub fn push_batch_best_effort<I>(&self, msgs: I) -> usize
Push a batch in best-effort mode.
When full, the oldest queued item is dropped for each incoming item.
pub fn register_subscriber(&self) -> u64
pub fn register_subscriber_with_policy(&self, reliable: bool) -> u64
pub fn unregister_subscriber(&self, subscriber_id: u64)
pub fn reconcile_virtual_reliable_subscribers<I, S>(&self, desired: I)
pub fn pop_for<T: Any + Clone + Send + 'static>( &self, subscriber_id: u64, ) -> Option<T>
pub fn ack_reliable_for(&self, subscriber_id: u64) -> Option<u64>
pub fn ack_for(&self, subscriber_id: u64) -> bool
pub fn pop_batch_for<T: Any + Clone + Send + 'static>( &self, subscriber_id: u64, max_items: usize, ) -> Vec<T>
pub fn pending_count_for(&self, subscriber_id: u64) -> usize
Sourcepub fn pop_batch(&self, max_items: usize) -> Vec<Box<dyn Any + Send>>
pub fn pop_batch(&self, max_items: usize) -> Vec<Box<dyn Any + Send>>
Pop up to max_items messages, preserving FIFO order.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of messages currently waiting in the slot.
Sourcepub fn remaining_capacity(&self) -> usize
pub fn remaining_capacity(&self) -> usize
Remaining capacity before hitting queue depth limit.
Sourcepub fn backpressure_signal(&self) -> BackpressureSignal
pub fn backpressure_signal(&self) -> BackpressureSignal
Backpressure state derived from queue utilization.
- Hard: queue full
- Soft: queue utilization >= 80%
- Clear: otherwise