From cff003c928f4cee548a540a610e0bf010bbf6a47 Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 19 Oct 2022 12:52:20 +0200 Subject: [PATCH] remove the unused variants from the autobatcher --- index-scheduler/src/autobatcher.rs | 22 +++++++--------------- index-scheduler/src/batch.rs | 1 - 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/index-scheduler/src/autobatcher.rs b/index-scheduler/src/autobatcher.rs index a6adfd549..83b0d56ab 100644 --- a/index-scheduler/src/autobatcher.rs +++ b/index-scheduler/src/autobatcher.rs @@ -22,10 +22,6 @@ enum AutobatchKind { IndexDeletion, IndexUpdate, IndexSwap, - TaskCancelation, - TaskDeletion, - DumpExport, - Snapshot, } impl AutobatchKind { @@ -62,10 +58,12 @@ impl From 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 { .. } diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index 4bafe8494..ab6e4d5bd 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -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};