pub struct AppState { /* private fields */ }Expand description
Shared, cloneable application state handed to every handler.
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(kindling_home: PathBuf) -> Self
pub fn new(kindling_home: PathBuf) -> Self
Build state rooted at kindling_home. Project DBs live under
kindling_home/projects/<hash>/kindling.db.
Sourcepub fn kindling_home(&self) -> &PathBuf
pub fn kindling_home(&self) -> &PathBuf
kindling home root.
Sourcepub fn activity(&self) -> &Arc<Activity> ⓘ
pub fn activity(&self) -> &Arc<Activity> ⓘ
Activity tracker (for the idle-shutdown layer/task).
Sourcepub fn known_project_ids(&self) -> Vec<String>
pub fn known_project_ids(&self) -> Vec<String>
Project ids for every project that has been touched this session (used
by /v1/health). Sorted for deterministic output.
Sourcepub fn service_for(
&self,
project_root: &str,
) -> Result<Arc<Mutex<KindlingService>>, ApiError>
pub fn service_for( &self, project_root: &str, ) -> Result<Arc<Mutex<KindlingService>>, ApiError>
Resolve (and lazily open) the service for project_root. The DB path is
derived from the store’s hashing — the single source of truth — so the
daemon and any other consumer of the same project share one database.
Returns a clone of the per-project Arc<Mutex<KindlingService>>; the
caller locks it, does synchronous DB work, and drops the lock. Never
hold this lock across an .await.
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 UnsafeUnpin 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