pub mod request_downloader;
pub mod response_cache_remote;
use crate::common::model::download_config::DownloadConfig;
use crate::common::model::{Request, Response};
use crate::errors::Result;
use semver::Version;
pub mod downloader_manager;
pub mod websocket_downloader;
pub use websocket_downloader::WebSocketDownloader;
pub use downloader_manager::DownloaderManager;
#[async_trait::async_trait]
pub trait Downloader: dyn_clone::DynClone + Send + Sync + 'static {
async fn set_config(&self, id: &str, config: DownloadConfig);
async fn set_limit(&self, id: &str, limit: f32);
fn name(&self) -> String;
fn version(&self) -> Version;
async fn download(&self, request: Request) -> Result<Response>;
async fn health_check(&self) -> Result<()>;
async fn close(&self) -> Result<()> {
Ok(())
}
}
dyn_clone::clone_trait_object!(Downloader);