use tokio::sync::{Mutex}; use std::sync::Arc; use crate::api::model::active_provider_manager::ActiveProviderManager; use crate::api::model::active_user_manager::ActiveUserManager; use crate::api::model::download::DownloadQueue; use crate::api::model::streams::shared_stream_manager::SharedStreamManager; use crate::model::config::{Config}; use crate::model::hdhomerun_config::HdHomeRunDeviceConfig; use crate::tools::lru_cache::LRUResourceCache; #[derive(Clone)] pub struct AppState { pub config: Arc, pub http_client: Arc, pub downloads: Arc, pub cache: Arc>>, pub shared_stream_manager: Arc, pub active_users: Arc, pub active_provider: Arc, } impl AppState { pub async fn get_active_connections_for_user(&self, username: &str) -> u32 { self.active_users.user_connections(username).await } } #[derive(Clone)] pub struct HdHomerunAppState { pub app_state: Arc, pub device: Arc, }