pub enum SnapshotEvent {
ManifestLoaded {
snapshot_id: String,
chunks: usize,
},
ChunkStarted {
chunk_id: String,
size_bytes: u64,
},
ChunkProgress {
chunk_id: String,
bytes_downloaded: u64,
bytes_total: u64,
},
ChunkCompleted {
chunk_id: String,
articles_count: u64,
elapsed: Duration,
},
ArticleProcessed {
article_id: u64,
title: String,
},
CheckpointSaved {
path: PathBuf,
},
Error {
error: StreamError,
recoverable: bool,
},
Completed {
total_articles: u64,
total_bytes: u64,
},
}Expand description
Progress event for snapshot processing.
These events allow you to monitor the progress of snapshot downloads and processing. Use them to update progress bars or log activity.
§Example
use wme_stream::SnapshotEvent;
fn handle_event(event: SnapshotEvent) {
match event {
SnapshotEvent::ChunkStarted { chunk_id, size_bytes } => {
println!("Starting download of {} ({} bytes)", chunk_id, size_bytes);
}
SnapshotEvent::ChunkProgress { chunk_id, bytes_downloaded, bytes_total } => {
let pct = (bytes_downloaded as f64 / bytes_total as f64) * 100.0;
println!("{}: {:.1}%", chunk_id, pct);
}
SnapshotEvent::ArticleProcessed { article_id, title } => {
println!("Processed: {}", title);
}
_ => {}
}
}Variants§
ManifestLoaded
Manifest loaded successfully.
ChunkStarted
Chunk download started.
ChunkProgress
Chunk download progress.
Fields
ChunkCompleted
Chunk processing completed.
Fields
ArticleProcessed
Individual article processed.
CheckpointSaved
Checkpoint saved.
Error
Error occurred.
Completed
Processing completed.
Trait Implementations§
Source§impl Clone for SnapshotEvent
impl Clone for SnapshotEvent
Source§fn clone(&self) -> SnapshotEvent
fn clone(&self) -> SnapshotEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SnapshotEvent
impl RefUnwindSafe for SnapshotEvent
impl Send for SnapshotEvent
impl Sync for SnapshotEvent
impl Unpin for SnapshotEvent
impl UnsafeUnpin for SnapshotEvent
impl UnwindSafe for SnapshotEvent
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