Skip to main content

TopicSlot

Struct TopicSlot 

Source
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

Source

pub fn new(max_depth: usize) -> Self

Source

pub fn new_with_reliability_policy( max_depth: usize, reliability_policy: TopicReliabilityPolicy, ) -> Self

Source

pub fn set_reliability_policy(&self, reliability_policy: TopicReliabilityPolicy)

Source

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.

Source

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.

Source

pub fn push_batch<I>(&self, msgs: I) -> usize
where I: IntoIterator<Item = Box<dyn Any + Send>>,

Push a batch of messages and return the number accepted before reaching capacity.

Source

pub fn push_batch_best_effort<I>(&self, msgs: I) -> usize
where I: IntoIterator<Item = Box<dyn Any + Send>>,

Push a batch in best-effort mode.

When full, the oldest queued item is dropped for each incoming item.

Source

pub fn register_subscriber(&self) -> u64

Source

pub fn register_subscriber_with_policy(&self, reliable: bool) -> u64

Source

pub fn unregister_subscriber(&self, subscriber_id: u64)

Source

pub fn reconcile_virtual_reliable_subscribers<I, S>(&self, desired: I)
where I: IntoIterator<Item = (S, Option<u64>)>, S: Into<String>,

Source

pub fn pop_for<T: Any + Clone + Send + 'static>( &self, subscriber_id: u64, ) -> Option<T>

Source

pub fn ack_reliable_for(&self, subscriber_id: u64) -> Option<u64>

Source

pub fn ack_for(&self, subscriber_id: u64) -> bool

Source

pub fn pop_batch_for<T: Any + Clone + Send + 'static>( &self, subscriber_id: u64, max_items: usize, ) -> Vec<T>

Source

pub fn pending_count_for(&self, subscriber_id: u64) -> usize

Source

pub fn pop(&self) -> Option<Box<dyn Any + Send>>

Pop the oldest message, if any.

Source

pub fn pop_batch(&self, max_items: usize) -> Vec<Box<dyn Any + Send>>

Pop up to max_items messages, preserving FIFO order.

Source

pub fn pending_count(&self) -> usize

Number of messages currently waiting in the slot.

Source

pub fn remaining_capacity(&self) -> usize

Remaining capacity before hitting queue depth limit.

Source

pub fn backpressure_signal(&self) -> BackpressureSignal

Backpressure state derived from queue utilization.

  • Hard: queue full
  • Soft: queue utilization >= 80%
  • Clear: otherwise
Source

pub fn max_depth(&self) -> usize

Source

pub fn load_entry(&self, topic: &str) -> TopicLoadEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.