pub struct AppState {
pub known_projects: Arc<RwLock<HashMap<PathBuf, ProjectInfo>>>,
pub active_project_path: Arc<RwLock<PathBuf>>,
pub host_project: ProjectInfo,
pub port: u16,
pub ws_state: WebSocketState,
pub shutdown_tx: Arc<Mutex<Option<Sender<()>>>>,
}Expand description
Dashboard server state shared across handlers
Fields§
§known_projects: Arc<RwLock<HashMap<PathBuf, ProjectInfo>>>Known projects (path -> info). No connection pools - SQLite opens fast.
active_project_path: Arc<RwLock<PathBuf>>Currently active project path (for UI display)
host_project: ProjectInfoThe project that started the Dashboard (always considered online)
port: u16§ws_state: WebSocketStateWebSocket state for real-time connections
shutdown_tx: Arc<Mutex<Option<Sender<()>>>>Shutdown signal sender (for graceful shutdown via HTTP)
Implementations§
Source§impl AppState
impl AppState
Sourcepub async fn get_db_pool(
&self,
project_path: &PathBuf,
) -> Result<SqlitePool, String>
pub async fn get_db_pool( &self, project_path: &PathBuf, ) -> Result<SqlitePool, String>
Get database pool for a project (opens on demand - SQLite is fast)
Sourcepub async fn get_active_db_pool(&self) -> Result<SqlitePool, String>
pub async fn get_active_db_pool(&self) -> Result<SqlitePool, String>
Get database pool for the active project
Sourcepub async fn add_project(&self, path: PathBuf) -> Result<(), String>
pub async fn add_project(&self, path: PathBuf) -> Result<(), String>
Add a new project (or update existing)
Sourcepub async fn get_active_project(&self) -> Option<ProjectInfo>
pub async fn get_active_project(&self) -> Option<ProjectInfo>
Get active project info
Sourcepub async fn switch_active_project(&self, path: PathBuf) -> Result<(), String>
pub async fn switch_active_project(&self, path: PathBuf) -> Result<(), String>
Switch active project
Sourcepub async fn remove_project(&self, path: &PathBuf) -> Result<(), String>
pub async fn remove_project(&self, path: &PathBuf) -> Result<(), String>
Remove a project from known projects and global registry
Sourcepub async fn get_active_project_context(
&self,
) -> Result<(SqlitePool, String), String>
pub async fn get_active_project_context( &self, ) -> Result<(SqlitePool, String), String>
Get active project’s db_pool and path (backward compatibility helper) Returns (db_pool, project_path_string)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppState
impl !RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl !UnwindSafe for AppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more