Skip to main content

SubscriptionResource

Trait SubscriptionResource 

Source
pub trait SubscriptionResource: Debug + Send {
    // Required methods
    fn unsubscribe(self: Box<Self>) -> Result<(), ServerError>;
    fn try_next(&mut self) -> Option<Envelope>;
    fn has_pending(&self) -> bool;

    // Provided methods
    fn is_overflowed(&self) -> bool { ... }
    fn subscriber_pid(&self) -> Option<u64> { ... }
    fn try_next_positioned(
        &mut self,
    ) -> Result<Option<(Envelope, Option<u64>)>, ServerError> { ... }
    fn acknowledge_position(&self, position: u64) -> Result<(), ServerError> { ... }
    fn consumer_position(&self) -> Result<Option<u64>, ServerError> { ... }
}
Expand description

Marker for resources retained by a connection process until unsubscribe.

Required Methods§

Source

fn unsubscribe(self: Box<Self>) -> Result<(), ServerError>

Releases the library subscription resource.

§Errors

Returns ServerError when the liminal library reports an unsubscribe failure.

Source

fn try_next(&mut self) -> Option<Envelope>

Attempts to pull the next delivered envelope from the wrapped library subscription without blocking.

Returns None when the subscriber inbox is empty (or momentarily unavailable): the connection process is the delivery pump, so a transient empty read is simply “nothing to deliver this slice”, never an error.

Source

fn has_pending(&self) -> bool

Non-consuming availability query for the post-arm race barrier.

Provided Methods§

Source

fn is_overflowed(&self) -> bool

Whether an overflow has marked this subscription for shedding (§5). The delivery pump sheds an overflowed subscription with a typed error frame. Defaulted to false: a resource with no bounded inbox never overflows.

Source

fn subscriber_pid(&self) -> Option<u64>

The library subscriber’s pid, the id a recording publish names it by. Defaulted to None: a resource with no library subscriber is never a recipient.

Source

fn try_next_positioned( &mut self, ) -> Result<Option<(Envelope, Option<u64>)>, ServerError>

Reads a delivery and its durable position without acknowledging it.

§Errors

The underlying subscription cannot be read.

Source

fn acknowledge_position(&self, position: u64) -> Result<(), ServerError>

Checkpoints a delivery after its consumer settles it.

§Errors

The resource has no durable acknowledgement path, or checkpointing failed.

Source

fn consumer_position(&self) -> Result<Option<u64>, ServerError>

Reads the subscription-owned durable checkpoint.

§Errors

The checkpoint cannot be read.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§