Skip to main content

SnapshotEvent

Enum SnapshotEvent 

Source
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.

Fields

§snapshot_id: String

Snapshot identifier

§chunks: usize

Number of chunks

§

ChunkStarted

Chunk download started.

Fields

§chunk_id: String

Chunk identifier

§size_bytes: u64

Size in bytes

§

ChunkProgress

Chunk download progress.

Fields

§chunk_id: String

Chunk identifier

§bytes_downloaded: u64

Bytes downloaded so far

§bytes_total: u64

Total bytes

§

ChunkCompleted

Chunk processing completed.

Fields

§chunk_id: String

Chunk identifier

§articles_count: u64

Number of articles processed

§elapsed: Duration

Elapsed time

§

ArticleProcessed

Individual article processed.

Fields

§article_id: u64

Article ID

§title: String

Article title

§

CheckpointSaved

Checkpoint saved.

Fields

§path: PathBuf

Path to checkpoint file

§

Error

Error occurred.

Fields

§error: StreamError

Error details

§recoverable: bool

Whether the error is recoverable

§

Completed

Processing completed.

Fields

§total_articles: u64

Total articles processed

§total_bytes: u64

Total bytes processed

Trait Implementations§

Source§

impl Clone for SnapshotEvent

Source§

fn clone(&self) -> SnapshotEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SnapshotEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.