pub struct Reader<E: Clock + Storage + Metrics, V: CodecShared> { /* private fields */ }Expand description
Reader handle for dequeuing and acknowledging items.
There should only be one reader per shared queue.
Implementations§
Source§impl<E: Clock + Storage + Metrics, V: CodecShared> Reader<E, V>
impl<E: Clock + Storage + Metrics, V: CodecShared> Reader<E, V>
Sourcepub async fn recv(&mut self) -> Result<Option<(u64, V)>, Error>
pub async fn recv(&mut self) -> Result<Option<(u64, V)>, Error>
Receive the next unacknowledged item, waiting if necessary.
This method is designed for use with select!. It will:
- Return immediately if an unacked item is available
- Wait for the writer to enqueue new items if the queue is empty
- Return
Noneif the writer is dropped (no more items will arrive)
§Errors
Returns an error if the underlying storage operation fails.
Sourcepub async fn try_recv(&mut self) -> Result<Option<(u64, V)>, Error>
pub async fn try_recv(&mut self) -> Result<Option<(u64, V)>, Error>
Try to dequeue the next unacknowledged item without waiting.
Returns None immediately if no unacked item is available.
§Errors
Returns an error if the underlying storage operation fails.
Sourcepub async fn ack_floor(&self) -> u64
pub async fn ack_floor(&self) -> u64
See Queue::ack_floor.
Sourcepub async fn read_position(&self) -> u64
pub async fn read_position(&self) -> u64
See Queue::read_position.
Sourcepub async fn is_empty(&self) -> bool
pub async fn is_empty(&self) -> bool
See Queue::is_empty.
Sourcepub async fn reset(&self)
pub async fn reset(&self)
See Queue::reset.
Auto Trait Implementations§
impl<E, V> Freeze for Reader<E, V>
impl<E, V> !RefUnwindSafe for Reader<E, V>
impl<E, V> Send for Reader<E, V>
impl<E, V> Sync for Reader<E, V>
impl<E, V> Unpin for Reader<E, V>
impl<E, V> UnsafeUnpin for Reader<E, V>
impl<E, V> !UnwindSafe for Reader<E, V>
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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