pub struct Scheduler { /* private fields */ }Implementations§
Source§impl Scheduler
impl Scheduler
Sourcepub fn new(
_initial_state: Option<()>,
) -> (Arc<Scheduler>, AsyncReceiver<Request>)
pub fn new( _initial_state: Option<()>, ) -> (Arc<Scheduler>, AsyncReceiver<Request>)
Creates a new Scheduler without checkpoint support and returns a tuple containing the scheduler and a request receiver.
Sourcepub async fn snapshot(&self) -> Result<(), SpiderError>
pub async fn snapshot(&self) -> Result<(), SpiderError>
Takes a snapshot of the current state of the scheduler (stub when checkpoint feature is disabled).
Sourcepub async fn enqueue_request(&self, request: Request) -> Result<(), SpiderError>
pub async fn enqueue_request(&self, request: Request) -> Result<(), SpiderError>
Enqueues a new request to be processed.
Sourcepub async fn shutdown(&self) -> Result<(), SpiderError>
pub async fn shutdown(&self) -> Result<(), SpiderError>
Sends a shutdown signal to the scheduler.
Sourcepub async fn send_mark_as_visited(
&self,
fingerprint: String,
) -> Result<(), SpiderError>
pub async fn send_mark_as_visited( &self, fingerprint: String, ) -> Result<(), SpiderError>
Sends a message to the scheduler to mark a URL as visited.
Sourcepub async fn send_mark_as_visited_batch(
&self,
fingerprints: Vec<String>,
) -> Result<(), SpiderError>
pub async fn send_mark_as_visited_batch( &self, fingerprints: Vec<String>, ) -> Result<(), SpiderError>
Sends a message to the scheduler to mark multiple URLs as visited in batch.
Sourcepub fn has_been_visited(&self, fingerprint: &str) -> bool
pub fn has_been_visited(&self, fingerprint: &str) -> bool
Checks if a URL has been visited using Bloom Filter for fast preliminary check
Sourcepub fn should_enqueue_request(&self, request: &Request) -> bool
pub fn should_enqueue_request(&self, request: &Request) -> bool
Checks if a request should be enqueued by checking if its fingerprint has already been visited
Auto Trait Implementations§
impl !Freeze for Scheduler
impl !RefUnwindSafe for Scheduler
impl Send for Scheduler
impl Sync for Scheduler
impl Unpin for Scheduler
impl !UnwindSafe for Scheduler
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