| 19 | LazyLock::new(|| RwLock::new(HashMap::new())); |
| 20 | |
| 21 | pub async fn setup() -> Result<()> { |
| 22 | info!("Setting up adr algorithms"); |
| 23 | let mut algos = ADR_ALGORITHMS.write().await; |
| 24 | |
| 25 | trace!("Setting up included algorithms"); |
| 26 | let a = default::Algorithm::new(); |
| 27 | algos.insert(a.get_id(), Box::new(a)); |
| 28 | |
| 29 | let a = lr_fhss::Algorithm::new(); |
| 30 | algos.insert(a.get_id(), Box::new(a)); |
| 31 | |
| 32 | let a = lora_lr_fhss::Algorithm::new(); |
| 33 | algos.insert(a.get_id(), Box::new(a)); |
| 34 | |
| 35 | trace!("Setting up plugins"); |
| 36 | let conf = config::get(); |
| 37 | for file_path in &conf.network.adr_plugins { |
| 38 | info!(file_path = %file_path, "Setting up ADR plugin"); |
| 39 | let a = plugin::Plugin::new(file_path)?; |
| 40 | algos.insert(a.get_id(), Box::new(a)); |
| 41 | } |
| 42 | |
| 43 | Ok(()) |
| 44 | } |
| 45 | |
| 46 | pub async fn get_algorithms() -> HashMap<String, String> { |
| 47 | let mut out: HashMap<String, String> = HashMap::new(); |