pub struct LocalQueue { /* private fields */ }Expand description
Local disk-persisted queue on turso (localqueue.v1).
Implements the Queue trait (send/receive/ack/nack/purge). Messages
survive process restarts, and multiple LocalQueue
handles — including handles in different OS processes — can safely share
one data directory.
Implementations§
Source§impl LocalQueue
impl LocalQueue
Sourcepub async fn new(data_dir: PathBuf) -> Result<Self>
pub async fn new(data_dir: PathBuf) -> Result<Self>
Create a new local queue store rooted at the given data directory.
The directory is created if missing; the store lives at
<data_dir>/localqueue.sqlite.
Sourcepub async fn from_binding(binding: LocalQueueBinding) -> Result<Self>
pub async fn from_binding(binding: LocalQueueBinding) -> Result<Self>
Create a LocalQueue from a LocalQueueBinding.
Trait Implementations§
impl Binding for LocalQueue
Source§impl Debug for LocalQueue
impl Debug for LocalQueue
Source§impl Queue for LocalQueue
impl Queue for LocalQueue
Source§fn nack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
receipt_handle: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn nack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
receipt_handle: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Negative-acknowledge a message: make it immediately visible again.
Same receipt rules as ack: a stale receipt (the message was
redelivered and a newer receipt supersedes this one) is rejected; a
receipt for an already-deleted message is an idempotent no-op.
Source§fn purge<'life0, 'life1, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn purge<'life0, 'life1, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete every message in the queue, visible or in flight.
Source§fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
message: MessagePayload,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
message: MessagePayload,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn receive<'life0, 'life1, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
max_messages: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<QueueMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn receive<'life0, 'life1, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
max_messages: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<QueueMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
max_messages (1..=10) from the specified queueSource§fn ack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
receipt_handle: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn ack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_queue: &'life1 str,
receipt_handle: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for LocalQueue
impl !UnwindSafe for LocalQueue
impl Freeze for LocalQueue
impl Send for LocalQueue
impl Sync for LocalQueue
impl Unpin for LocalQueue
impl UnsafeUnpin for LocalQueue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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>
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