pub struct SharedSystemState {Show 16 fields
pub conversations: Arc<ConversationHierarchy>,
pub llm_runtime: Arc<RwLock<Option<LLMRuntime>>>,
pub cache_manager: Arc<RwLock<Option<Arc<KVCacheManager>>>>,
pub database_pool: Arc<MemoryDatabase>,
pub config: Arc<Config>,
pub counters: Arc<AtomicCounters>,
pub context_orchestrator: Arc<RwLock<Option<ContextOrchestrator>>>,
pub llm_worker: Arc<LLMWorker>,
pub model_manager: Option<Arc<ModelManager>>,
pub runtime_manager: Arc<RwLock<Option<Arc<RuntimeManager>>>>,
pub engine_manager: Option<Arc<EngineManager>>,
pub engine_available: Arc<AtomicBool>,
pub initialization_complete: Arc<AtomicBool>,
pub http_port: Arc<RwLock<u16>>,
pub attachment_cache: Arc<DashMap<String, PreExtracted>>,
pub extraction_semaphore: Arc<Semaphore>,
}Expand description
Core shared system state container
Fields§
§conversations: Arc<ConversationHierarchy>Conversation data with hierarchical locking
llm_runtime: Arc<RwLock<Option<LLMRuntime>>>LLM runtime for direct inference
cache_manager: Arc<RwLock<Option<Arc<KVCacheManager>>>>Cache management system
database_pool: Arc<MemoryDatabase>Database connection pool
config: Arc<Config>Configuration (read-only after initialization)
counters: Arc<AtomicCounters>Atomic counters for performance tracking
context_orchestrator: Arc<RwLock<Option<ContextOrchestrator>>>Context orchestrator for memory management (tokio RwLock for async access)
llm_worker: Arc<LLMWorker>LLM worker for inference operations
model_manager: Option<Arc<ModelManager>>Model management system
runtime_manager: Arc<RwLock<Option<Arc<RuntimeManager>>>>Runtime management system
engine_manager: Option<Arc<EngineManager>>Engine management system
engine_available: Arc<AtomicBool>Engine availability flag - true when an engine binary is ready for use
initialization_complete: Arc<AtomicBool>Initialization completion flag - true when all components are ready
http_port: Arc<RwLock<u16>>HTTP server port - may differ from config if original port was in use
attachment_cache: Arc<DashMap<String, PreExtracted>>Pre-extracted attachment text cache.
Key: "inline:{path}" or "local_storage:{id}".
Populated by POST /attachments/preprocess while the user types;
consumed (and evicted) by /generate/stream at Send time.
extraction_semaphore: Arc<Semaphore>Limits concurrent binary-file extractions to num_cpus/2 (min 1, max 8) so the LLM server is never CPU-starved on low-spec hardware.
Implementations§
pub fn new(config: Config, database: Arc<MemoryDatabase>) -> Result<Self>
Sourcepub fn mark_initialization_complete(&self)
pub fn mark_initialization_complete(&self)
Mark initialization as complete - call this after all components are initialized
Sourcepub fn is_initialization_complete(&self) -> bool
pub fn is_initialization_complete(&self) -> bool
Check if initialization is complete
Sourcepub fn set_llm_worker(&self, _worker: Arc<LLMWorker>)
pub fn set_llm_worker(&self, _worker: Arc<LLMWorker>)
Set LLM worker (replaces the default one created during initialization)
Sourcepub fn set_runtime_manager(
&self,
runtime_manager: Arc<RuntimeManager>,
) -> Result<()>
pub fn set_runtime_manager( &self, runtime_manager: Arc<RuntimeManager>, ) -> Result<()>
Set runtime manager (allows setting after initialization)
Sourcepub fn initialize_llm_runtime(&self) -> Result<()>
pub fn initialize_llm_runtime(&self) -> Result<()>
Initialize LLM runtime with current configuration
Sourcepub async fn get_or_create_session(
&self,
session_id: &str,
) -> Arc<RwLock<SessionData>>
pub async fn get_or_create_session( &self, session_id: &str, ) -> Arc<RwLock<SessionData>>
Get or create session data with proper locking
Sourcepub fn queue_message(&self, session_id: &str, message: Message) -> bool
pub fn queue_message(&self, session_id: &str, message: Message) -> bool
Queue message for asynchronous processing
Sourcepub async fn process_queued_messages(
&self,
session_id: &str,
) -> Vec<PendingMessage>
pub async fn process_queued_messages( &self, session_id: &str, ) -> Vec<PendingMessage>
Process queued messages for a session
Auto Trait Implementations§
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
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>
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>
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