From d0e91555d12c6f50d95ffdb18941bd4663d4505b Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 17 Oct 2022 15:11:35 +0200 Subject: [PATCH] rebase on index-scheduler --- dump/Cargo.toml | 1 + dump/src/lib.rs | 7 +++++-- index-scheduler/src/lib.rs | 2 +- meilisearch-auth/Cargo.toml | 1 + meilisearch-auth/src/error.rs | 2 +- meilisearch-auth/src/store.rs | 1 + meilisearch-types/src/tasks.rs | 4 ++-- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dump/Cargo.toml b/dump/Cargo.toml index 09c2a8a10..8c89b6eca 100644 --- a/dump/Cargo.toml +++ b/dump/Cargo.toml @@ -21,6 +21,7 @@ meilisearch-types = { path = "../meilisearch-types" } http = "0.2.8" regex = "1.6.0" lazy_static = "1.4.0" +roaring = { version = "0.10.0", features = ["serde"] } [dev-dependencies] big_s = "1.0.2" diff --git a/dump/src/lib.rs b/dump/src/lib.rs index c13e5e8ed..4194e53a1 100644 --- a/dump/src/lib.rs +++ b/dump/src/lib.rs @@ -4,6 +4,7 @@ use meilisearch_types::{ settings::Unchecked, tasks::{Details, KindWithContent, Status, Task, TaskId}, }; +use roaring::RoaringBitmap; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; @@ -115,7 +116,7 @@ pub enum KindDump { }, DeleteTasks { query: String, - tasks: Vec, + tasks: RoaringBitmap, }, DumpExport { dump_uid: String, @@ -177,7 +178,9 @@ impl From for KindDump { } KindWithContent::IndexSwap { lhs, rhs } => KindDump::IndexSwap { lhs, rhs }, KindWithContent::CancelTask { tasks } => KindDump::CancelTask { tasks }, - KindWithContent::DeleteTasks { query, tasks } => KindDump::DeleteTasks { query, tasks }, + KindWithContent::TaskDeletion { query, tasks } => { + KindDump::DeleteTasks { query, tasks } + } KindWithContent::DumpExport { dump_uid, .. } => KindDump::DumpExport { dump_uid }, KindWithContent::Snapshot => KindDump::Snapshot, } diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index a65fa8bcd..fd99ec577 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -480,7 +480,7 @@ impl IndexScheduler { KindDump::IndexSwap { lhs, rhs } => KindWithContent::IndexSwap { lhs, rhs }, KindDump::CancelTask { tasks } => KindWithContent::CancelTask { tasks }, KindDump::DeleteTasks { query, tasks } => { - KindWithContent::DeleteTasks { query, tasks } + KindWithContent::TaskDeletion { query, tasks } } KindDump::DumpExport { dump_uid } => KindWithContent::DumpExport { dump_uid, diff --git a/meilisearch-auth/Cargo.toml b/meilisearch-auth/Cargo.toml index 1b62fd949..b10579615 100644 --- a/meilisearch-auth/Cargo.toml +++ b/meilisearch-auth/Cargo.toml @@ -14,3 +14,4 @@ sha2 = "0.10.6" thiserror = "1.0.37" time = { version = "0.3.15", features = ["serde-well-known", "formatting", "parsing", "macros"] } uuid = { version = "1.1.2", features = ["serde", "v4"] } +roaring = { version = "0.10.0", features = ["serde"] } diff --git a/meilisearch-auth/src/error.rs b/meilisearch-auth/src/error.rs index 41cb5619d..7da4cad33 100644 --- a/meilisearch-auth/src/error.rs +++ b/meilisearch-auth/src/error.rs @@ -18,7 +18,7 @@ pub enum AuthControllerError { } internal_error!( - AuthControllerError: milli::heed::Error, + AuthControllerError: meilisearch_types::milli::heed::Error, std::io::Error, serde_json::Error, std::str::Utf8Error diff --git a/meilisearch-auth/src/store.rs b/meilisearch-auth/src/store.rs index efbac3ae0..3a2673f10 100644 --- a/meilisearch-auth/src/store.rs +++ b/meilisearch-auth/src/store.rs @@ -11,6 +11,7 @@ use std::sync::Arc; use hmac::{Hmac, Mac}; use meilisearch_types::keys::KeyId; +use meilisearch_types::milli; use meilisearch_types::star_or::StarOr; use meilisearch_types::milli; use milli::heed::types::{ByteSlice, DecodeIgnore, SerdeJson}; diff --git a/meilisearch-types/src/tasks.rs b/meilisearch-types/src/tasks.rs index 1b408601f..2e0c4b1ab 100644 --- a/meilisearch-types/src/tasks.rs +++ b/meilisearch-types/src/tasks.rs @@ -87,7 +87,7 @@ impl Task { | KindWithContent::IndexUpdate { .. } | KindWithContent::IndexSwap { .. } | KindWithContent::CancelTask { .. } - | KindWithContent::DeleteTasks { .. } + | KindWithContent::TaskDeletion { .. } | KindWithContent::DumpExport { .. } | KindWithContent::Snapshot => None, } @@ -250,7 +250,7 @@ impl From<&KindWithContent> for Option
{ }), KindWithContent::IndexSwap { .. } => None, KindWithContent::CancelTask { .. } => None, - KindWithContent::DeleteTasks { .. } => todo!(), + KindWithContent::TaskDeletion { .. } => todo!(), KindWithContent::DumpExport { dump_uid, .. } => Some(Details::Dump { dump_uid: dump_uid.clone(), }),