From 8cd3a1aa571f7a1489dc84ffdad6ce790279cba1 Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 11 Dec 2024 18:18:40 +0100 Subject: [PATCH] fmt --- crates/index-scheduler/src/error.rs | 3 ++- .../index-scheduler/src/index_mapper/mod.rs | 9 ++++---- crates/index-scheduler/src/processing.rs | 13 ++++++----- crates/meilisearch-types/src/batch_view.rs | 8 +++---- crates/meilisearch-types/src/batches.rs | 6 ++--- crates/meilisearch/src/routes/batches.rs | 22 +++++++++---------- crates/meilitool/src/upgrade/mod.rs | 1 - crates/meilitool/src/upgrade/v1_10.rs | 17 +++++--------- crates/meilitool/src/upgrade/v1_11.rs | 10 ++++----- crates/meilitool/src/upgrade/v1_12.rs | 3 ++- crates/milli/src/progress.rs | 12 ++++------ 11 files changed, 47 insertions(+), 57 deletions(-) diff --git a/crates/index-scheduler/src/error.rs b/crates/index-scheduler/src/error.rs index 5fb04828c..69da70a7e 100644 --- a/crates/index-scheduler/src/error.rs +++ b/crates/index-scheduler/src/error.rs @@ -1,12 +1,13 @@ use std::fmt::Display; -use crate::TaskId; use meilisearch_types::batches::BatchId; use meilisearch_types::error::{Code, ErrorCode}; use meilisearch_types::tasks::{Kind, Status}; use meilisearch_types::{heed, milli}; use thiserror::Error; +use crate::TaskId; + #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum DateField { BeforeEnqueuedAt, diff --git a/crates/index-scheduler/src/index_mapper/mod.rs b/crates/index-scheduler/src/index_mapper/mod.rs index 8b9ef3597..2f5b176ed 100644 --- a/crates/index-scheduler/src/index_mapper/mod.rs +++ b/crates/index-scheduler/src/index_mapper/mod.rs @@ -3,10 +3,6 @@ use std::sync::{Arc, RwLock}; use std::time::Duration; use std::{fs, thread}; -use self::index_map::IndexMap; -use self::IndexStatus::{Available, BeingDeleted, Closing, Missing}; -use crate::uuid_codec::UuidCodec; -use crate::{Error, Result}; use meilisearch_types::heed::types::{SerdeJson, Str}; use meilisearch_types::heed::{Database, Env, RoTxn, RwTxn}; use meilisearch_types::milli; @@ -17,6 +13,11 @@ use time::OffsetDateTime; use tracing::error; use uuid::Uuid; +use self::index_map::IndexMap; +use self::IndexStatus::{Available, BeingDeleted, Closing, Missing}; +use crate::uuid_codec::UuidCodec; +use crate::{Error, Result}; + mod index_map; const INDEX_MAPPING: &str = "index-mapping"; diff --git a/crates/index-scheduler/src/processing.rs b/crates/index-scheduler/src/processing.rs index 57d90a40b..74802831e 100644 --- a/crates/index-scheduler/src/processing.rs +++ b/crates/index-scheduler/src/processing.rs @@ -1,11 +1,12 @@ -use crate::utils::ProcessingBatch; +use std::borrow::Cow; +use std::sync::Arc; + use enum_iterator::Sequence; -use meilisearch_types::milli::{ - make_atomic_progress, make_enum_progress, - progress::{AtomicSubStep, NamedStep, Progress, ProgressView, Step}, -}; +use meilisearch_types::milli::progress::{AtomicSubStep, NamedStep, Progress, ProgressView, Step}; +use meilisearch_types::milli::{make_atomic_progress, make_enum_progress}; use roaring::RoaringBitmap; -use std::{borrow::Cow, sync::Arc}; + +use crate::utils::ProcessingBatch; #[derive(Clone)] pub struct ProcessingTasks { diff --git a/crates/meilisearch-types/src/batch_view.rs b/crates/meilisearch-types/src/batch_view.rs index a3d7f834f..08d25413c 100644 --- a/crates/meilisearch-types/src/batch_view.rs +++ b/crates/meilisearch-types/src/batch_view.rs @@ -2,11 +2,9 @@ use milli::progress::ProgressView; use serde::Serialize; use time::{Duration, OffsetDateTime}; -use crate::{ - batches::{Batch, BatchId, BatchStats}, - task_view::DetailsView, - tasks::serialize_duration, -}; +use crate::batches::{Batch, BatchId, BatchStats}; +use crate::task_view::DetailsView; +use crate::tasks::serialize_duration; #[derive(Debug, Clone, Serialize)] #[serde(rename_all = "camelCase")] diff --git a/crates/meilisearch-types/src/batches.rs b/crates/meilisearch-types/src/batches.rs index 34af21f60..664dafa7a 100644 --- a/crates/meilisearch-types/src/batches.rs +++ b/crates/meilisearch-types/src/batches.rs @@ -4,10 +4,8 @@ use milli::progress::ProgressView; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; -use crate::{ - task_view::DetailsView, - tasks::{Kind, Status}, -}; +use crate::task_view::DetailsView; +use crate::tasks::{Kind, Status}; pub type BatchId = u32; diff --git a/crates/meilisearch/src/routes/batches.rs b/crates/meilisearch/src/routes/batches.rs index 6faedc021..4d42cdd16 100644 --- a/crates/meilisearch/src/routes/batches.rs +++ b/crates/meilisearch/src/routes/batches.rs @@ -1,18 +1,18 @@ -use actix_web::{ - web::{self, Data}, - HttpResponse, -}; +use actix_web::web::{self, Data}; +use actix_web::HttpResponse; use deserr::actix_web::AwebQueryParameter; use index_scheduler::{IndexScheduler, Query}; -use meilisearch_types::{ - batch_view::BatchView, batches::BatchId, deserr::DeserrQueryParamError, error::ResponseError, - keys::actions, -}; +use meilisearch_types::batch_view::BatchView; +use meilisearch_types::batches::BatchId; +use meilisearch_types::deserr::DeserrQueryParamError; +use meilisearch_types::error::ResponseError; +use meilisearch_types::keys::actions; use serde::Serialize; -use crate::extractors::{authentication::GuardedData, sequential_extractor::SeqHandler}; - -use super::{tasks::TasksFilterQuery, ActionPolicy}; +use super::tasks::TasksFilterQuery; +use super::ActionPolicy; +use crate::extractors::authentication::GuardedData; +use crate::extractors::sequential_extractor::SeqHandler; pub fn configure(cfg: &mut web::ServiceConfig) { cfg.service(web::resource("").route(web::get().to(SeqHandler(get_batches)))) diff --git a/crates/meilitool/src/upgrade/mod.rs b/crates/meilitool/src/upgrade/mod.rs index 50882f610..14f941311 100644 --- a/crates/meilitool/src/upgrade/mod.rs +++ b/crates/meilitool/src/upgrade/mod.rs @@ -7,7 +7,6 @@ use std::path::{Path, PathBuf}; use anyhow::{bail, Context}; use meilisearch_types::versioning::create_version_file; - use v1_10::v1_9_to_v1_10; use v1_12::v1_11_to_v1_12; diff --git a/crates/meilitool/src/upgrade/v1_10.rs b/crates/meilitool/src/upgrade/v1_10.rs index 2efc1773c..4a49ea471 100644 --- a/crates/meilitool/src/upgrade/v1_10.rs +++ b/crates/meilitool/src/upgrade/v1_10.rs @@ -1,18 +1,13 @@ -use anyhow::bail; use std::path::Path; -use anyhow::Context; -use meilisearch_types::{ - heed::{ - types::{SerdeJson, Str}, - Database, Env, EnvOpenOptions, RoTxn, RwTxn, Unspecified, - }, - milli::index::{db_name, main_key}, -}; - -use crate::{try_opening_database, try_opening_poly_database, uuid_codec::UuidCodec}; +use anyhow::{bail, Context}; +use meilisearch_types::heed::types::{SerdeJson, Str}; +use meilisearch_types::heed::{Database, Env, EnvOpenOptions, RoTxn, RwTxn, Unspecified}; +use meilisearch_types::milli::index::{db_name, main_key}; use super::v1_9; +use crate::uuid_codec::UuidCodec; +use crate::{try_opening_database, try_opening_poly_database}; pub type FieldDistribution = std::collections::BTreeMap; diff --git a/crates/meilitool/src/upgrade/v1_11.rs b/crates/meilitool/src/upgrade/v1_11.rs index 0c84d3842..92d853dd0 100644 --- a/crates/meilitool/src/upgrade/v1_11.rs +++ b/crates/meilitool/src/upgrade/v1_11.rs @@ -7,12 +7,12 @@ use std::path::Path; use anyhow::Context; -use meilisearch_types::{ - heed::{types::Str, Database, EnvOpenOptions}, - milli::index::db_name, -}; +use meilisearch_types::heed::types::Str; +use meilisearch_types::heed::{Database, EnvOpenOptions}; +use meilisearch_types::milli::index::db_name; -use crate::{try_opening_database, try_opening_poly_database, uuid_codec::UuidCodec}; +use crate::uuid_codec::UuidCodec; +use crate::{try_opening_database, try_opening_poly_database}; pub fn v1_10_to_v1_11(db_path: &Path) -> anyhow::Result<()> { println!("Upgrading from v1.10.0 to v1.11.0"); diff --git a/crates/meilitool/src/upgrade/v1_12.rs b/crates/meilitool/src/upgrade/v1_12.rs index 85fb41472..444617375 100644 --- a/crates/meilitool/src/upgrade/v1_12.rs +++ b/crates/meilitool/src/upgrade/v1_12.rs @@ -1,7 +1,8 @@ //! The breaking changes that happened between the v1.11 and the v1.12 are: //! - The new indexer changed the update files format from OBKV to ndjson. https://github.com/meilisearch/meilisearch/pull/4900 -use std::{io::BufWriter, path::Path}; +use std::io::BufWriter; +use std::path::Path; use anyhow::Context; use file_store::FileStore; diff --git a/crates/milli/src/progress.rs b/crates/milli/src/progress.rs index 96483ebd0..d50be43cb 100644 --- a/crates/milli/src/progress.rs +++ b/crates/milli/src/progress.rs @@ -1,11 +1,7 @@ -use std::{ - any::TypeId, - borrow::Cow, - sync::{ - atomic::{AtomicU32, Ordering}, - Arc, RwLock, - }, -}; +use std::any::TypeId; +use std::borrow::Cow; +use std::sync::atomic::{AtomicU32, Ordering}; +use std::sync::{Arc, RwLock}; use serde::Serialize;