#[derive(Debug)]
pub struct IndexTransaction {
completed: bool,
}
impl IndexTransaction {
pub fn new(_data: &()) -> Self {
Self { completed: false }
}
#[deprecated(note = "Snapshot functionality is handled by Tantivy")]
pub fn snapshot(&self) -> &() {
&()
}
pub fn complete(&mut self) {
self.completed = true;
}
pub fn is_active(&self) -> bool {
!self.completed
}
}
impl Drop for IndexTransaction {
fn drop(&mut self) {
if !self.completed {
eprintln!("Warning: IndexTransaction dropped without explicit commit or rollback");
}
}
}
pub struct FileTransaction {
file_id: Option<crate::FileId>,
completed: bool,
}
impl Default for FileTransaction {
fn default() -> Self {
Self::new()
}
}
impl FileTransaction {
pub fn new() -> Self {
Self {
file_id: None,
completed: false,
}
}
pub fn set_file_id(&mut self, file_id: crate::FileId) {
self.file_id = Some(file_id);
}
pub fn file_id(&self) -> Option<crate::FileId> {
self.file_id
}
pub fn complete(&mut self) {
self.completed = true;
}
}