mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-25 22:34:28 +01:00
Add more enum-iterator related stuff
This commit is contained in:
parent
591527a99d
commit
b2c5bc67b7
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1756,6 +1756,7 @@ dependencies = [
|
|||||||
"csv",
|
"csv",
|
||||||
"derive_builder",
|
"derive_builder",
|
||||||
"dump",
|
"dump",
|
||||||
|
"enum-iterator",
|
||||||
"file-store",
|
"file-store",
|
||||||
"insta",
|
"insta",
|
||||||
"log",
|
"log",
|
||||||
|
@ -9,19 +9,20 @@ edition = "2021"
|
|||||||
anyhow = "1.0.64"
|
anyhow = "1.0.64"
|
||||||
bincode = "1.3.3"
|
bincode = "1.3.3"
|
||||||
csv = "1.1.6"
|
csv = "1.1.6"
|
||||||
|
derive_builder = "0.11.2"
|
||||||
|
dump = { path = "../dump" }
|
||||||
|
enum-iterator = "1.1.3"
|
||||||
file-store = { path = "../file-store" }
|
file-store = { path = "../file-store" }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
meilisearch-types = { path = "../meilisearch-types" }
|
meilisearch-types = { path = "../meilisearch-types" }
|
||||||
roaring = { version = "0.10.0", features = ["serde"] }
|
roaring = { version = "0.10.0", features = ["serde"] }
|
||||||
dump = { path = "../dump" }
|
|
||||||
serde = { version = "1.0.136", features = ["derive"] }
|
serde = { version = "1.0.136", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.85", features = ["preserve_order"] }
|
serde_json = { version = "1.0.85", features = ["preserve_order"] }
|
||||||
|
synchronoise = "1.0.1"
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
thiserror = "1.0.30"
|
thiserror = "1.0.30"
|
||||||
time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsing", "macros"] }
|
time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsing", "macros"] }
|
||||||
uuid = { version = "1.1.2", features = ["serde", "v4"] }
|
uuid = { version = "1.1.2", features = ["serde", "v4"] }
|
||||||
synchronoise = "1.0.1"
|
|
||||||
derive_builder = "0.11.2"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
crossbeam = "0.8.2"
|
crossbeam = "0.8.2"
|
||||||
|
@ -687,7 +687,7 @@ impl IndexScheduler {
|
|||||||
| KindWithContent::IndexCreation { .. }
|
| KindWithContent::IndexCreation { .. }
|
||||||
| KindWithContent::IndexUpdate { .. }
|
| KindWithContent::IndexUpdate { .. }
|
||||||
| KindWithContent::IndexSwap { .. }
|
| KindWithContent::IndexSwap { .. }
|
||||||
| KindWithContent::CancelTask { .. }
|
| KindWithContent::TaskCancelation { .. }
|
||||||
| KindWithContent::TaskDeletion { .. }
|
| KindWithContent::TaskDeletion { .. }
|
||||||
| KindWithContent::DumpExport { .. }
|
| KindWithContent::DumpExport { .. }
|
||||||
| KindWithContent::Snapshot => Ok(()),
|
| KindWithContent::Snapshot => Ok(()),
|
||||||
|
@ -2,24 +2,18 @@
|
|||||||
|
|
||||||
use meilisearch_types::heed::{types::DecodeIgnore, RoTxn, RwTxn};
|
use meilisearch_types::heed::{types::DecodeIgnore, RoTxn, RwTxn};
|
||||||
use meilisearch_types::milli::BEU32;
|
use meilisearch_types::milli::BEU32;
|
||||||
use roaring::RoaringBitmap;
|
use roaring::{MultiOps, RoaringBitmap};
|
||||||
|
|
||||||
use crate::{Error, IndexScheduler, Result, Task, TaskId};
|
use crate::{Error, IndexScheduler, Result, Task, TaskId};
|
||||||
use meilisearch_types::tasks::{Kind, Status};
|
use meilisearch_types::tasks::{Kind, Status};
|
||||||
|
|
||||||
impl IndexScheduler {
|
impl IndexScheduler {
|
||||||
pub(crate) fn all_task_ids(&self, rtxn: &RoTxn) -> Result<RoaringBitmap> {
|
pub(crate) fn all_task_ids(&self, rtxn: &RoTxn) -> Result<RoaringBitmap> {
|
||||||
let mut all_tasks = RoaringBitmap::new();
|
enum_iterator::all()
|
||||||
for status in [
|
.map(|s| self.get_status(&rtxn, s))
|
||||||
Status::Enqueued,
|
.r#union()
|
||||||
Status::Processing,
|
|
||||||
Status::Succeeded,
|
|
||||||
Status::Failed,
|
|
||||||
] {
|
|
||||||
all_tasks |= self.get_status(&rtxn, status)?;
|
|
||||||
}
|
|
||||||
Ok(all_tasks)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn last_task_id(&self, rtxn: &RoTxn) -> Result<Option<TaskId>> {
|
pub(crate) fn last_task_id(&self, rtxn: &RoTxn) -> Result<Option<TaskId>> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.all_tasks
|
.all_tasks
|
||||||
|
@ -8,10 +8,10 @@ enum-iterator = "1.1.3"
|
|||||||
hmac = "0.12.1"
|
hmac = "0.12.1"
|
||||||
meilisearch-types = { path = "../meilisearch-types" }
|
meilisearch-types = { path = "../meilisearch-types" }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
roaring = { version = "0.10.0", features = ["serde"] }
|
||||||
serde = { version = "1.0.145", features = ["derive"] }
|
serde = { version = "1.0.145", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.85", features = ["preserve_order"] }
|
serde_json = { version = "1.0.85", features = ["preserve_order"] }
|
||||||
sha2 = "0.10.6"
|
sha2 = "0.10.6"
|
||||||
thiserror = "1.0.37"
|
thiserror = "1.0.37"
|
||||||
time = { version = "0.3.15", features = ["serde-well-known", "formatting", "parsing", "macros"] }
|
time = { version = "0.3.15", features = ["serde-well-known", "formatting", "parsing", "macros"] }
|
||||||
uuid = { version = "1.1.2", features = ["serde", "v4"] }
|
uuid = { version = "1.1.2", features = ["serde", "v4"] }
|
||||||
roaring = { version = "0.10.0", features = ["serde"] }
|
|
||||||
|
@ -16,8 +16,8 @@ proptest-derive = { version = "0.3.0", optional = true }
|
|||||||
roaring = { version = "0.10.0", features = ["serde"] }
|
roaring = { version = "0.10.0", features = ["serde"] }
|
||||||
serde = { version = "1.0.145", features = ["derive"] }
|
serde = { version = "1.0.145", features = ["derive"] }
|
||||||
serde_json = "1.0.85"
|
serde_json = "1.0.85"
|
||||||
time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsing", "macros"] }
|
|
||||||
thiserror = "1.0.30"
|
thiserror = "1.0.30"
|
||||||
|
time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsing", "macros"] }
|
||||||
tokio = "1.0"
|
tokio = "1.0"
|
||||||
uuid = { version = "1.1.2", features = ["serde", "v4"] }
|
uuid = { version = "1.1.2", features = ["serde", "v4"] }
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
use std::fmt::{Display, Write};
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
use enum_iterator::Sequence;
|
use enum_iterator::Sequence;
|
||||||
use milli::update::IndexDocumentsMethod;
|
use milli::update::IndexDocumentsMethod;
|
||||||
use roaring::RoaringBitmap;
|
use roaring::RoaringBitmap;
|
||||||
use serde::{Deserialize, Serialize, Serializer};
|
use serde::{Deserialize, Serialize, Serializer};
|
||||||
use std::{
|
|
||||||
fmt::{Display, Write},
|
|
||||||
str::FromStr,
|
|
||||||
};
|
|
||||||
use time::{Duration, OffsetDateTime};
|
use time::{Duration, OffsetDateTime};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user