pub struct ScanHandle { /* private fields */ }Expand description
Live state of one scan.
All fields are Arc<…> because handles are shared between the
background scan task and any number of HTTP request handlers.
Implementations§
Source§impl ScanHandle
impl ScanHandle
Sourcepub fn new(
username: impl Into<String>,
site_count: usize,
outcome_buffer: usize,
) -> Self
pub fn new( username: impl Into<String>, site_count: usize, outcome_buffer: usize, ) -> Self
Construct an empty handle ready to accept outcomes.
site_count is the size of the site list this scan will run
against — surfaced through Self::site_count so the UI can
render 423 / 1890 progress without holding open an SSE
stream. outcome_buffer sizes the broadcast ring buffer; a
value substantially larger than site_count is fine — the cost
is one Arc<…> slot per buffered notification.
Sourcepub fn site_count(&self) -> usize
pub fn site_count(&self) -> usize
Total number of sites this scan will / did probe.
Sourcepub fn created_at_ms(&self) -> u64
pub fn created_at_ms(&self) -> u64
Unix epoch milliseconds when this handle was constructed. Used by the history endpoint so the UI can render relative times.
Sourcepub async fn outcomes_snapshot(&self) -> Vec<CheckOutcome>
pub async fn outcomes_snapshot(&self) -> Vec<CheckOutcome>
Snapshot of outcomes recorded so far. Cheap clone — Vec deep-clones
only the small number of strings inside each CheckOutcome.
Sourcepub async fn finished(&self) -> Option<FinishedScan>
pub async fn finished(&self) -> Option<FinishedScan>
Final aggregate, once the scan has completed. None while running.
Sourcepub fn is_finished_now(&self) -> bool
pub fn is_finished_now(&self) -> bool
Best-effort sync peek used by the eviction policy. Returns
false if the lock is currently held — a momentarily-locked
finished slot is, by construction, still being mutated.
Sourcepub fn subscribe(&self) -> Receiver<usize>
pub fn subscribe(&self) -> Receiver<usize>
Subscribe to “new outcome appended at index N” notifications.
Combine with Self::outcomes_snapshot for “replay then live” semantics.
Trait Implementations§
Source§impl Clone for ScanHandle
impl Clone for ScanHandle
Source§fn clone(&self) -> ScanHandle
fn clone(&self) -> ScanHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more