pub struct Queue<S, V, C = SystemClock> { /* private fields */ }Expand description
A brokerless queue occupying exactly one object.
The object store is retained through an Arc, matching the sharing model
used by other objsds structure handles.
Implementations§
Source§impl<S, V, C> Queue<S, V, C>
impl<S, V, C> Queue<S, V, C>
Sourcepub fn publish(&self, value: V) -> Result<MessageId, Error<S::Error>>
pub fn publish(&self, value: V) -> Result<MessageId, Error<S::Error>>
Publishes a message and returns its stable identifier.
A conflict means the message was not applied. A store error can be ambiguous; retrying with a new generated ID can therefore duplicate a message.
Sourcepub fn claim(
&self,
lease_duration: Duration,
) -> Result<Option<Claim<V>>, Error<S::Error>>where
V: Clone,
pub fn claim(
&self,
lease_duration: Duration,
) -> Result<Option<Claim<V>>, Error<S::Error>>where
V: Clone,
Claims the oldest available message for the requested lease duration.
A message is available when never claimed or when its prior lease’s
exclusive deadline is at or before the current clock value. Returns
None without writing if no message is available.
Sourcepub fn ack(
&self,
id: MessageId,
token: LeaseToken,
) -> Result<Ack, Error<S::Error>>
pub fn ack( &self, id: MessageId, token: LeaseToken, ) -> Result<Ack, Error<S::Error>>
Acknowledges and removes a message when the current unexpired lease matches.
Ack::Acknowledged is the only durable outcome. Other Ack values
return without writing, so callers must not treat them as a stable
terminal state without reading a fresh snapshot or claiming again.