data_gov/ui/
mod.rs

1use std::path::PathBuf;
2
3#[derive(Debug, Clone)]
4pub struct DownloadBatch {
5    pub resource_count: usize,
6    pub dataset_name: Option<String>,
7}
8
9#[derive(Debug, Clone)]
10pub struct DownloadStarted {
11    pub resource_name: Option<String>,
12    pub dataset_name: Option<String>,
13    pub url: String,
14    pub output_path: PathBuf,
15    pub total_bytes: Option<u64>,
16}
17
18#[derive(Debug, Clone)]
19pub struct DownloadProgress {
20    pub resource_name: Option<String>,
21    pub dataset_name: Option<String>,
22    pub output_path: PathBuf,
23    pub downloaded_bytes: u64,
24    pub total_bytes: Option<u64>,
25}
26
27#[derive(Debug, Clone)]
28pub struct DownloadFinished {
29    pub resource_name: Option<String>,
30    pub dataset_name: Option<String>,
31    pub output_path: PathBuf,
32}
33
34#[derive(Debug, Clone)]
35pub struct DownloadFailed {
36    pub resource_name: Option<String>,
37    pub dataset_name: Option<String>,
38    pub output_path: Option<PathBuf>,
39    pub error: String,
40}
41
42pub trait StatusReporter: Send + Sync {
43    fn on_download_batch(&self, _event: &DownloadBatch) {}
44    fn on_download_started(&self, _event: &DownloadStarted) {}
45    fn on_download_progress(&self, _event: &DownloadProgress) {}
46    fn on_download_finished(&self, _event: &DownloadFinished) {}
47    fn on_download_failed(&self, _event: &DownloadFailed) {}
48}