dittolive_ditto/store/attachment/fetch_event.rs
1use super::DittoAttachment;
2
3#[derive(Debug)]
4
5/// A representation of the events that can occur in relation to an attachment fetch.
6///
7/// There are three different attachment fetch events: `Completed`, `Progress`, or `Deleted`.
8///
9/// There will be at most one `completed` or `deleted` event per attachment fetch. There can be many
10/// `progress` events delivered for each attachment fetch.
11///
12/// Updates relating to an attachment fetch are delivered by registering a `DittoAttachmentFetcher`
13/// through a call to [`fetch_attachment`](crate::store::collection::Collection::fetch_attachment)
14pub enum DittoAttachmentFetchEvent {
15 /// An attachment fetch event used when the attachment's download has
16 /// completed.
17 Completed { attachment: DittoAttachment },
18 /// An attachment fetch event used when the attachment's download has
19 /// progressed but is not yet complete.
20 Progress {
21 downloaded_bytes: u64,
22 total_bytes: u64,
23 },
24 /// An attachment fetch event used when the attachment is deleted.
25 Deleted,
26}