remove the unused variants from the autobatcher

This commit is contained in:
Tamo 2022-10-19 12:52:20 +02:00 committed by Clément Renault
parent ab8f1c2865
commit cff003c928
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
2 changed files with 7 additions and 16 deletions

View File

@ -22,10 +22,6 @@ enum AutobatchKind {
IndexDeletion,
IndexUpdate,
IndexSwap,
TaskCancelation,
TaskDeletion,
DumpExport,
Snapshot,
}
impl AutobatchKind {
@ -62,10 +58,12 @@ impl From<KindWithContent> for AutobatchKind {
KindWithContent::IndexCreation { .. } => AutobatchKind::IndexCreation,
KindWithContent::IndexUpdate { .. } => AutobatchKind::IndexUpdate,
KindWithContent::IndexSwap { .. } => AutobatchKind::IndexSwap,
KindWithContent::TaskCancelation { .. } => AutobatchKind::TaskCancelation,
KindWithContent::TaskDeletion { .. } => AutobatchKind::TaskDeletion,
KindWithContent::DumpExport { .. } => AutobatchKind::DumpExport,
KindWithContent::Snapshot => AutobatchKind::Snapshot,
KindWithContent::TaskCancelation { .. }
| KindWithContent::TaskDeletion { .. }
| KindWithContent::DumpExport { .. }
| KindWithContent::Snapshot => {
panic!("The autobatcher should never be called with tasks that don't apply to an index.")
}
}
}
}
@ -154,9 +152,6 @@ impl BatchKind {
allow_index_creation,
settings_ids: vec![task_id],
}),
K::DumpExport | K::Snapshot | K::TaskCancelation | K::TaskDeletion => {
unreachable!()
}
}
}
@ -268,7 +263,7 @@ impl BatchKind {
BatchKind::Settings { settings_ids, allow_index_creation },
K::DocumentClear,
) => Continue(BatchKind::ClearAndSettings {
settings_ids: settings_ids,
settings_ids,
allow_index_creation,
other: vec![id],
}),
@ -379,9 +374,6 @@ impl BatchKind {
import_ids,
})
}
(_, K::TaskCancelation | K::TaskDeletion | K::DumpExport | K::Snapshot) => {
unreachable!()
}
(
BatchKind::IndexCreation { .. }
| BatchKind::IndexDeletion { .. }

View File

@ -1,7 +1,6 @@
use std::collections::HashSet;
use std::fs::File;
use std::io::BufWriter;
use std::sync::atomic::Ordering::Relaxed;
use crate::{autobatcher::BatchKind, Error, IndexScheduler, Result, TaskId};