Add more enum-iterator related stuff

This commit is contained in:
Kerollmops 2022-10-18 11:02:46 +02:00 committed by Clément Renault
parent 591527a99d
commit b2c5bc67b7
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
7 changed files with 17 additions and 22 deletions

View file

@ -9,23 +9,24 @@ edition = "2021"
anyhow = "1.0.64"
bincode = "1.3.3"
csv = "1.1.6"
derive_builder = "0.11.2"
dump = { path = "../dump" }
enum-iterator = "1.1.3"
file-store = { path = "../file-store" }
log = "0.4.14"
meilisearch-types = { path = "../meilisearch-types" }
roaring = { version = "0.10.0", features = ["serde"] }
dump = { path = "../dump" }
serde = { version = "1.0.136", features = ["derive"] }
serde_json = { version = "1.0.85", features = ["preserve_order"] }
synchronoise = "1.0.1"
tempfile = "3.3.0"
thiserror = "1.0.30"
time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsing", "macros"] }
uuid = { version = "1.1.2", features = ["serde", "v4"] }
synchronoise = "1.0.1"
derive_builder = "0.11.2"
[dev-dependencies]
crossbeam = "0.8.2"
nelson = { git = "https://github.com/meilisearch/nelson.git", rev = "675f13885548fb415ead8fbb447e9e6d9314000a"}
insta = { version = "1.19.1", features = ["json", "redactions"] }
big_s = "1.0.2"
meili-snap = { path = "../meili-snap" }
meili-snap = { path = "../meili-snap" }

View file

@ -687,7 +687,7 @@ impl IndexScheduler {
| KindWithContent::IndexCreation { .. }
| KindWithContent::IndexUpdate { .. }
| KindWithContent::IndexSwap { .. }
| KindWithContent::CancelTask { .. }
| KindWithContent::TaskCancelation { .. }
| KindWithContent::TaskDeletion { .. }
| KindWithContent::DumpExport { .. }
| KindWithContent::Snapshot => Ok(()),

View file

@ -2,24 +2,18 @@
use meilisearch_types::heed::{types::DecodeIgnore, RoTxn, RwTxn};
use meilisearch_types::milli::BEU32;
use roaring::RoaringBitmap;
use roaring::{MultiOps, RoaringBitmap};
use crate::{Error, IndexScheduler, Result, Task, TaskId};
use meilisearch_types::tasks::{Kind, Status};
impl IndexScheduler {
pub(crate) fn all_task_ids(&self, rtxn: &RoTxn) -> Result<RoaringBitmap> {
let mut all_tasks = RoaringBitmap::new();
for status in [
Status::Enqueued,
Status::Processing,
Status::Succeeded,
Status::Failed,
] {
all_tasks |= self.get_status(&rtxn, status)?;
}
Ok(all_tasks)
enum_iterator::all()
.map(|s| self.get_status(&rtxn, s))
.r#union()
}
pub(crate) fn last_task_id(&self, rtxn: &RoTxn) -> Result<Option<TaskId>> {
Ok(self
.all_tasks