romm_api/core/download/manager/
mod.rs1mod extras;
4mod rom;
5
6use std::sync::{Arc, Mutex};
7
8use super::extras_job::ExtrasJob;
9use super::job::DownloadJob;
10
11#[derive(Clone)]
15pub struct DownloadManager {
16 pub(super) jobs: Arc<Mutex<Vec<DownloadJob>>>,
17 pub(super) extras_jobs: Arc<Mutex<Vec<ExtrasJob>>>,
18}
19
20impl Default for DownloadManager {
21 fn default() -> Self {
22 Self::new()
23 }
24}
25
26impl DownloadManager {
27 pub fn new() -> Self {
28 Self {
29 jobs: Arc::new(Mutex::new(Vec::new())),
30 extras_jobs: Arc::new(Mutex::new(Vec::new())),
31 }
32 }
33
34 pub fn shared(&self) -> Arc<Mutex<Vec<DownloadJob>>> {
36 self.jobs.clone()
37 }
38
39 pub fn shared_extras(&self) -> Arc<Mutex<Vec<ExtrasJob>>> {
41 self.extras_jobs.clone()
42 }
43}