pub struct DataGovConfig {
pub catalog_config: Arc<Configuration>,
pub mode: OperatingMode,
pub base_download_dir: PathBuf,
pub user_agent: String,
pub max_concurrent_downloads: usize,
pub download_timeout_secs: u64,
pub status_reporter: Option<Arc<dyn StatusReporter + Send + Sync>>,
}Expand description
Configuration for the Data.gov client
Fields§
§catalog_config: Arc<Configuration>Catalog API client configuration
mode: OperatingModeOperating mode (affects base download directory)
base_download_dir: PathBufBase download directory for files (before dataset subdirectory)
user_agent: StringUser agent for HTTP requests
max_concurrent_downloads: usizeMaximum concurrent downloads
download_timeout_secs: u64Timeout for downloads in seconds
status_reporter: Option<Arc<dyn StatusReporter + Send + Sync>>Optional status reporter for UI callbacks
Implementations§
Source§impl DataGovConfig
impl DataGovConfig
Sourcepub fn with_download_dir<P: Into<PathBuf>>(self, dir: P) -> Self
pub fn with_download_dir<P: Into<PathBuf>>(self, dir: P) -> Self
Create configuration with a custom base download directory.
Sourcepub fn with_mode(self, mode: OperatingMode) -> Self
pub fn with_mode(self, mode: OperatingMode) -> Self
Set the operating mode.
Sourcepub fn get_base_download_dir(&self) -> PathBuf
pub fn get_base_download_dir(&self) -> PathBuf
Get the base download directory based on operating mode.
Sourcepub fn get_dataset_download_dir(&self, dataset_name: &str) -> PathBuf
pub fn get_dataset_download_dir(&self, dataset_name: &str) -> PathBuf
Get the full download directory for a specific dataset.
Sourcepub fn with_base_url<S: Into<String>>(self, base_url: S) -> Self
pub fn with_base_url<S: Into<String>>(self, base_url: S) -> Self
Override the Catalog API base URL (e.g., for testing with a mock server).
Sourcepub fn with_user_agent<S: Into<String>>(self, user_agent: S) -> Self
pub fn with_user_agent<S: Into<String>>(self, user_agent: S) -> Self
Set a custom user agent.
Sourcepub fn with_max_concurrent_downloads(self, max: usize) -> Self
pub fn with_max_concurrent_downloads(self, max: usize) -> Self
Set the maximum concurrent downloads.
Sourcepub fn with_download_timeout(self, timeout_secs: u64) -> Self
pub fn with_download_timeout(self, timeout_secs: u64) -> Self
Set the download timeout.
Sourcepub fn with_status_reporter<R>(self, reporter: Arc<R>) -> Self
pub fn with_status_reporter<R>(self, reporter: Arc<R>) -> Self
Attach a status reporter for UI callbacks.
Sourcepub fn without_status_reporter(self) -> Self
pub fn without_status_reporter(self) -> Self
Remove any configured status reporter.
Sourcepub fn status_reporter(&self) -> Option<&Arc<dyn StatusReporter + Send + Sync>>
pub fn status_reporter(&self) -> Option<&Arc<dyn StatusReporter + Send + Sync>>
Borrow the configured status reporter.