nodedb_lite/engine/fts/
state.rs1use std::sync::atomic::AtomicBool;
10use std::sync::{Arc, Mutex};
11
12use nodedb_mem::MemoryGovernor;
13
14use super::manager::FtsCollectionManager;
15
16pub type LiteFtsIndex = super::FtsIndex<super::MemoryBackend>;
18
19pub struct FtsState {
24 pub(crate) manager: Mutex<FtsCollectionManager>,
25 pub(super) mutation_gate: Arc<tokio::sync::Mutex<()>>,
26 pub(super) checkpoint_trusted: AtomicBool,
27}
28
29impl FtsState {
30 pub fn new(governor: Arc<MemoryGovernor>) -> Self {
32 Self {
33 manager: Mutex::new(FtsCollectionManager::new(governor)),
34 mutation_gate: Arc::new(tokio::sync::Mutex::new(())),
35 checkpoint_trusted: AtomicBool::new(false),
36 }
37 }
38
39 pub fn from_restored(manager: FtsCollectionManager) -> Self {
41 Self {
42 manager: Mutex::new(manager),
43 mutation_gate: Arc::new(tokio::sync::Mutex::new(())),
44 checkpoint_trusted: AtomicBool::new(false),
45 }
46 }
47}