pub struct RequestQueueWithSitemap { /* private fields */ }Expand description
A request queue that lazily feeds sitemap entries into another queue.
The wrapper lets the crawler consume already-queued work first, then drains the sitemap in bounded batches whenever the inner queue becomes empty.
§Example
use std::sync::Arc;
use millipede_core::{
sitemap::{RequestQueueWithSitemap, SitemapRequestList},
storage::RequestQueue,
};
let queue: Arc<dyn RequestQueue> =
Arc::new(RequestQueueWithSitemap::new(inner, list).batch_size(64));Implementations§
Source§impl RequestQueueWithSitemap
impl RequestQueueWithSitemap
Sourcepub fn new(inner: Arc<dyn RequestQueue>, list: SitemapRequestList) -> Self
pub fn new(inner: Arc<dyn RequestQueue>, list: SitemapRequestList) -> Self
Wraps inner with a sitemap source, draining at most 32 entries per pass.
Sourcepub fn batch_size(self, n: usize) -> Self
pub fn batch_size(self, n: usize) -> Self
Sets the maximum number of sitemap entries drained per pass.
Trait Implementations§
Source§impl RequestQueue for RequestQueueWithSitemap
impl RequestQueue for RequestQueueWithSitemap
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 false while sitemap entries remain undrained, preventing premature engine
termination; once the sitemap is drained, delegates to the inner queue.
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 false while sitemap entries remain undrained, preventing premature engine
termination; once the sitemap is drained, delegates to the inner queue.
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 only the inner queue’s pending count. Undrained sitemap entries are not included because their count is unknown until the sitemap is streamed.
Source§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<'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,
Source§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 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,
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,
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,
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,
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,
LeaseNotFound if it is unknown or completed.