Skip to main content

mentedb_server/
state.rs

1//! Shared application state for the MenteDB server.
2use mentedb::MenteDb;
3use mentedb_extraction::ExtractionConfig;
4use std::sync::Arc;
5use std::time::Instant;
6
7use crate::extraction_queue::ExtractionSender;
8
9#[derive(Clone)]
10pub struct AppState {
11    pub db: Arc<MenteDb>,
12    pub spaces: Arc<tokio::sync::RwLock<mentedb_core::SpaceManager>>,
13    pub jwt_secret: Option<String>,
14    pub admin_key: Option<String>,
15    pub start_time: Instant,
16    /// Extraction pipeline configuration. `None` means no LLM provider configured.
17    pub extraction_config: Option<ExtractionConfig>,
18    /// When true, storing a conversation-type memory auto-runs extraction.
19    pub auto_extract: bool,
20    /// Bounded channel sender for the background extraction worker.
21    pub extraction_tx: Option<ExtractionSender>,
22}