mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-11 23:26:28 +00:00
write and test the compat layer from v3 to v4
This commit is contained in:
@ -3,7 +3,7 @@ use uuid::Uuid;
|
||||
|
||||
use super::Settings;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(test, derive(serde::Serialize))]
|
||||
pub struct IndexUuid {
|
||||
pub uid: String,
|
||||
|
@ -34,7 +34,7 @@ use time::OffsetDateTime;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub mod errors;
|
||||
mod meta;
|
||||
pub mod meta;
|
||||
pub mod settings;
|
||||
pub mod updates;
|
||||
|
||||
@ -42,7 +42,7 @@ use crate::{IndexMetadata, Result, Version};
|
||||
|
||||
use self::meta::{DumpMeta, IndexUuid};
|
||||
|
||||
use super::{DumpReader, IndexReader};
|
||||
use super::{compat::v3_to_v4::CompatV3ToV4, IndexReader};
|
||||
|
||||
pub type Document = serde_json::Map<String, serde_json::Value>;
|
||||
pub type Settings<T> = settings::Settings<T>;
|
||||
@ -63,7 +63,7 @@ pub type Setting<T> = settings::Setting<T>;
|
||||
|
||||
// everything related to the errors
|
||||
// pub type ResponseError = errors::ResponseError;
|
||||
pub type Code = meilisearch_types::error::Code;
|
||||
pub type Code = errors::Code;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@ -79,7 +79,7 @@ pub struct V3Reader {
|
||||
dump: TempDir,
|
||||
metadata: Metadata,
|
||||
tasks: BufReader<File>,
|
||||
index_uuid: Vec<IndexUuid>,
|
||||
pub index_uuid: Vec<IndexUuid>,
|
||||
}
|
||||
|
||||
impl V3Reader {
|
||||
@ -103,9 +103,9 @@ impl V3Reader {
|
||||
})
|
||||
}
|
||||
|
||||
// pub fn to_v4(self) -> CompatV3ToV4 {
|
||||
// CompatV3ToV4::new(self)
|
||||
// }
|
||||
pub fn to_v4(self) -> CompatV3ToV4 {
|
||||
CompatV3ToV4::new(self)
|
||||
}
|
||||
|
||||
pub fn version(&self) -> Version {
|
||||
Version::V3
|
||||
|
@ -61,6 +61,13 @@ impl UpdateStatus {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_finished(&self) -> bool {
|
||||
match self {
|
||||
UpdateStatus::Processing(_) | UpdateStatus::Enqueued(_) => false,
|
||||
UpdateStatus::Aborted(_) | UpdateStatus::Failed(_) | UpdateStatus::Processed(_) => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn processed(&self) -> Option<&Processed> {
|
||||
match self {
|
||||
UpdateStatus::Processed(p) => Some(p),
|
||||
|
Reference in New Issue
Block a user