pub struct MemoryRequestQueue { /* private fields */ }Expand description
A thread-safe, lease-based request queue stored entirely in memory.
Implementations§
Source§impl MemoryRequestQueue
impl MemoryRequestQueue
Sourcepub fn with_policy(name: impl Into<String>, policy: MemoryQueuePolicy) -> Self
pub fn with_policy(name: impl Into<String>, policy: MemoryQueuePolicy) -> Self
Creates an empty queue using the selected frontier policy.
Trait Implementations§
Source§impl Debug for MemoryRequestQueue
impl Debug for MemoryRequestQueue
Source§impl RequestQueue for MemoryRequestQueue
impl RequestQueue for MemoryRequestQueue
Source§fn add<'life0, 'async_trait>(
&'life0 self,
request: 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,
request: 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.
Source§fn add_batch<'life0, 'async_trait>(
&'life0 self,
requests: 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,
requests: 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.
Source§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 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.
Source§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 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.
Source§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 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. Read moreSource§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 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.Source§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 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. Read more
Source§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_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.
Source§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 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.
Source§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 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.
Source§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,
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.
Auto Trait Implementations§
impl !Freeze for MemoryRequestQueue
impl RefUnwindSafe for MemoryRequestQueue
impl Send for MemoryRequestQueue
impl Sync for MemoryRequestQueue
impl Unpin for MemoryRequestQueue
impl UnsafeUnpin for MemoryRequestQueue
impl UnwindSafe for MemoryRequestQueue
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