chore(tool manager): Added ToolDownloadAgent

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-12-31 13:18:00 +11:00
parent 01383b514b
commit e147088375
6 changed files with 31 additions and 35 deletions
+29 -19
View File
@@ -1,26 +1,36 @@
use std::path::PathBuf;
use std::sync::Arc;
use super::external_component::ExternalComponent;
use crate::download_manager::{download_thread_control_flag::DownloadThreadControl, downloadable::Downloadable, progress_object::ProgressObject};
pub struct Tool {
name: String,
pub struct ToolDownloadAgent {
id: String,
version: String,
location: Option<PathBuf>,
location: String,
control_flag: DownloadThreadControl,
progress: Arc<ProgressObject>,
}
impl ExternalComponent for Tool {
fn download(&mut self) {
impl Downloadable for ToolDownloadAgent {
fn id(&self) -> String {
self.id.clone()
}
fn progress(&self) -> Arc<ProgressObject> {
self.progress.clone()
}
fn control_flag(&self) -> DownloadThreadControl {
self.control_flag.clone()
}
fn install_dir(&self) -> String {
self.location.clone()
}
fn version(&self) -> String {
self.version.clone()
}
fn download(&mut self) -> Result<(), crate::download_manager::application_download_error::ApplicationDownloadError> {
todo!()
}
fn version(&self) -> &String {
&self.version
}
fn is_installed(&self) -> bool {
self.location.is_some()
}
fn location(&self) -> &Option<PathBuf> {
&self.location
}
}