chasm/api/state.rs
1// Copyright (c) 2024-2026 Nervosys LLC
2// SPDX-License-Identifier: AGPL-3.0-only
3//! Application state for the API server
4
5use std::path::PathBuf;
6use std::sync::Mutex;
7
8use crate::database::ChatDatabase;
9
10/// Shared application state
11pub struct AppState {
12 pub db: Mutex<ChatDatabase>,
13 #[allow(dead_code)] // Reserved for future use (e.g., reopening database)
14 pub db_path: PathBuf,
15}
16
17impl AppState {
18 pub fn new(db: ChatDatabase, db_path: PathBuf) -> Self {
19 Self {
20 db: Mutex::new(db),
21 db_path,
22 }
23 }
24}