pub trait RequestQueue: Send + Sync {
// Required methods
fn add<'life0, 'async_trait>(
&'life0 self,
req: Request,
opts: AddOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<QueueOpInfo>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<RequestSource>,
opts: AddOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<BatchAddHandle>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fetch_next<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Lease>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn mark_handled<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn reclaim<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
opts: ReclaimOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn renew<'life0, 'life1, 'async_trait>(
&'life0 self,
lease_id: &'life1 LeaseId,
extend_by: Duration,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn abandon<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_finished<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn handled_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pending_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Object-safe queue with temporary lease ownership.
Single-process backends may document lease expiry as a no-op, but must retain this complete lease API so callers and distributed backends share one contract.
Required Methods§
Sourcefn add<'life0, 'async_trait>(
&'life0 self,
req: Request,
opts: AddOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<QueueOpInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add<'life0, 'async_trait>(
&'life0 self,
req: Request,
opts: AddOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<QueueOpInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Adds a request and returns its deduplication status.
Sourcefn add_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<RequestSource>,
opts: AddOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<BatchAddHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<RequestSource>,
opts: AddOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<BatchAddHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Adds multiple request sources and returns a handle for deferred completion.
Sourcefn fetch_next<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Lease>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_next<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Lease>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Hands temporary ownership of the next request to the caller as a lease.
Sourcefn mark_handled<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_handled<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Marks a leased request as successful and consumes its lease.
Sourcefn reclaim<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
opts: ReclaimOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reclaim<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
opts: ReclaimOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Re-queues a lease, incrementing retry count unless opts disables it.
Backends must persist the request state carried in the lease (e.g. mutated error_messages
or session_rotation_count), not a previously stored copy.
Sourcefn renew<'life0, 'life1, 'async_trait>(
&'life0 self,
lease_id: &'life1 LeaseId,
extend_by: Duration,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn renew<'life0, 'life1, 'async_trait>(
&'life0 self,
lease_id: &'life1 LeaseId,
extend_by: Duration,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extends an active lease deadline, returning LeaseNotFound if it is unknown or completed.
Sourcefn abandon<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn abandon<'life0, 'async_trait>(
&'life0 self,
lease: Lease,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Re-queues and consumes a lease without incrementing its request retry count.
Backends must persist the request state carried in the lease (e.g. mutated error_messages
or session_rotation_count), not a previously stored copy.
Sourcefn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns whether no requests are currently pending.
Sourcefn is_finished<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_finished<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns whether no requests are pending or leased.
Sourcefn handled_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handled_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the number of successfully handled requests.
Sourcefn pending_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pending_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the number of pending requests.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".