use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Mutex};
use nodedb_mem::MemoryGovernor;
use super::manager::FtsCollectionManager;
pub type LiteFtsIndex = super::FtsIndex<super::MemoryBackend>;
pub struct FtsState {
pub(crate) manager: Mutex<FtsCollectionManager>,
pub(super) mutation_gate: Arc<tokio::sync::Mutex<()>>,
pub(super) checkpoint_trusted: AtomicBool,
}
impl FtsState {
pub fn new(governor: Arc<MemoryGovernor>) -> Self {
Self {
manager: Mutex::new(FtsCollectionManager::new(governor)),
mutation_gate: Arc::new(tokio::sync::Mutex::new(())),
checkpoint_trusted: AtomicBool::new(false),
}
}
pub fn from_restored(manager: FtsCollectionManager) -> Self {
Self {
manager: Mutex::new(manager),
mutation_gate: Arc::new(tokio::sync::Mutex::new(())),
checkpoint_trusted: AtomicBool::new(false),
}
}
}