mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-12 07:36:29 +00:00
write the compat layer from v2 to v3
This commit is contained in:
@ -91,6 +91,9 @@ pub enum Code {
|
||||
MissingContentType,
|
||||
MalformedPayload,
|
||||
MissingPayload,
|
||||
|
||||
MalformedDump,
|
||||
UnretrievableErrorCode,
|
||||
}
|
||||
|
||||
impl Code {
|
||||
@ -181,6 +184,10 @@ impl Code {
|
||||
ErrCode::invalid("invalid_content_type", StatusCode::UNSUPPORTED_MEDIA_TYPE)
|
||||
}
|
||||
MissingPayload => ErrCode::invalid("missing_payload", StatusCode::BAD_REQUEST),
|
||||
UnretrievableErrorCode => {
|
||||
ErrCode::invalid("unretrievable_error_code", StatusCode::BAD_REQUEST)
|
||||
}
|
||||
MalformedDump => ErrCode::invalid("malformed_dump", StatusCode::BAD_REQUEST),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ pub struct V3Reader {
|
||||
dump: TempDir,
|
||||
metadata: Metadata,
|
||||
tasks: BufReader<File>,
|
||||
pub index_uuid: Vec<IndexUuid>,
|
||||
index_uuid: Vec<IndexUuid>,
|
||||
}
|
||||
|
||||
impl V3Reader {
|
||||
@ -100,6 +100,10 @@ impl V3Reader {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn index_uuid(&self) -> Vec<IndexUuid> {
|
||||
self.index_uuid.clone()
|
||||
}
|
||||
|
||||
pub fn to_v4(self) -> CompatV3ToV4 {
|
||||
CompatV3ToV4::new(self)
|
||||
}
|
||||
|
@ -179,6 +179,17 @@ impl<T> Default for Setting<T> {
|
||||
}
|
||||
|
||||
impl<T> Setting<T> {
|
||||
pub fn map<U, F>(self, f: F) -> Setting<U>
|
||||
where
|
||||
F: FnOnce(T) -> U,
|
||||
{
|
||||
match self {
|
||||
Setting::Set(t) => Setting::Set(f(t)),
|
||||
Setting::Reset => Setting::Reset,
|
||||
Setting::NotSet => Setting::NotSet,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set(self) -> Option<T> {
|
||||
match self {
|
||||
Self::Set(value) => Some(value),
|
||||
|
Reference in New Issue
Block a user