mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Rename the Snapshot task into SnapshotCreation
This commit is contained in:
parent
4d43a9f5b1
commit
e0548e42e7
@ -129,7 +129,7 @@ pub enum KindDump {
|
|||||||
keys: Vec<Key>,
|
keys: Vec<Key>,
|
||||||
instance_uid: Option<InstanceUid>,
|
instance_uid: Option<InstanceUid>,
|
||||||
},
|
},
|
||||||
Snapshot,
|
SnapshotCreation,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Task> for TaskDump {
|
impl From<Task> for TaskDump {
|
||||||
@ -191,7 +191,7 @@ impl From<KindWithContent> for KindDump {
|
|||||||
KindWithContent::DumpCreation { dump_uid, keys, instance_uid } => {
|
KindWithContent::DumpCreation { dump_uid, keys, instance_uid } => {
|
||||||
KindDump::DumpCreation { dump_uid, keys, instance_uid }
|
KindDump::DumpCreation { dump_uid, keys, instance_uid }
|
||||||
}
|
}
|
||||||
KindWithContent::Snapshot => KindDump::Snapshot,
|
KindWithContent::SnapshotCreation => KindDump::SnapshotCreation,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ impl From<KindWithContent> for AutobatchKind {
|
|||||||
KindWithContent::TaskCancelation { .. }
|
KindWithContent::TaskCancelation { .. }
|
||||||
| KindWithContent::TaskDeletion { .. }
|
| KindWithContent::TaskDeletion { .. }
|
||||||
| KindWithContent::DumpCreation { .. }
|
| KindWithContent::DumpCreation { .. }
|
||||||
| KindWithContent::Snapshot => {
|
| KindWithContent::SnapshotCreation => {
|
||||||
panic!("The autobatcher should never be called with tasks that don't apply to an index.")
|
panic!("The autobatcher should never be called with tasks that don't apply to an index.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ use crate::{Error, IndexScheduler, Query, Result, TaskId};
|
|||||||
pub(crate) enum Batch {
|
pub(crate) enum Batch {
|
||||||
TaskCancelation(Task),
|
TaskCancelation(Task),
|
||||||
TaskDeletion(Task),
|
TaskDeletion(Task),
|
||||||
Snapshot(Vec<Task>),
|
SnapshotCreation(Vec<Task>),
|
||||||
Dump(Task),
|
Dump(Task),
|
||||||
IndexOperation { op: IndexOperation, must_create_index: bool },
|
IndexOperation { op: IndexOperation, must_create_index: bool },
|
||||||
IndexCreation { index_uid: String, primary_key: Option<String>, task: Task },
|
IndexCreation { index_uid: String, primary_key: Option<String>, task: Task },
|
||||||
@ -118,7 +118,7 @@ impl Batch {
|
|||||||
| Batch::Dump(task)
|
| Batch::Dump(task)
|
||||||
| Batch::IndexCreation { task, .. }
|
| Batch::IndexCreation { task, .. }
|
||||||
| Batch::IndexUpdate { task, .. } => vec![task.uid],
|
| Batch::IndexUpdate { task, .. } => vec![task.uid],
|
||||||
Batch::Snapshot(tasks) | Batch::IndexDeletion { tasks, .. } => {
|
Batch::SnapshotCreation(tasks) | Batch::IndexDeletion { tasks, .. } => {
|
||||||
tasks.iter().map(|task| task.uid).collect()
|
tasks.iter().map(|task| task.uid).collect()
|
||||||
}
|
}
|
||||||
Batch::IndexOperation { op, .. } => match op {
|
Batch::IndexOperation { op, .. } => match op {
|
||||||
@ -406,9 +406,9 @@ impl IndexScheduler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. we batch the snapshot.
|
// 3. we batch the snapshot.
|
||||||
let to_snapshot = self.get_kind(rtxn, Kind::Snapshot)? & enqueued;
|
let to_snapshot = self.get_kind(rtxn, Kind::SnapshotCreation)? & enqueued;
|
||||||
if !to_snapshot.is_empty() {
|
if !to_snapshot.is_empty() {
|
||||||
return Ok(Some(Batch::Snapshot(self.get_existing_tasks(rtxn, to_snapshot)?)));
|
return Ok(Some(Batch::SnapshotCreation(self.get_existing_tasks(rtxn, to_snapshot)?)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. we batch the dumps.
|
// 4. we batch the dumps.
|
||||||
@ -552,7 +552,7 @@ impl IndexScheduler {
|
|||||||
wtxn.commit()?;
|
wtxn.commit()?;
|
||||||
Ok(vec![task])
|
Ok(vec![task])
|
||||||
}
|
}
|
||||||
Batch::Snapshot(_) => todo!(),
|
Batch::SnapshotCreation(_) => todo!(),
|
||||||
Batch::Dump(mut task) => {
|
Batch::Dump(mut task) => {
|
||||||
let started_at = OffsetDateTime::now_utc();
|
let started_at = OffsetDateTime::now_utc();
|
||||||
let (keys, instance_uid, dump_uid) =
|
let (keys, instance_uid, dump_uid) =
|
||||||
|
@ -708,7 +708,7 @@ impl IndexScheduler {
|
|||||||
KindDump::DumpCreation { dump_uid, keys, instance_uid } => {
|
KindDump::DumpCreation { dump_uid, keys, instance_uid } => {
|
||||||
KindWithContent::DumpCreation { dump_uid, keys, instance_uid }
|
KindWithContent::DumpCreation { dump_uid, keys, instance_uid }
|
||||||
}
|
}
|
||||||
KindDump::Snapshot => KindWithContent::Snapshot,
|
KindDump::SnapshotCreation => KindWithContent::SnapshotCreation,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ pub fn swap_index_uid_in_task(task: &mut Task, swap: (&str, &str)) {
|
|||||||
K::TaskCancelation { .. }
|
K::TaskCancelation { .. }
|
||||||
| K::TaskDeletion { .. }
|
| K::TaskDeletion { .. }
|
||||||
| K::DumpCreation { .. }
|
| K::DumpCreation { .. }
|
||||||
| K::Snapshot => {}
|
| K::SnapshotCreation => (),
|
||||||
};
|
};
|
||||||
if let Some(Details::IndexSwap { swaps }) = &mut task.details {
|
if let Some(Details::IndexSwap { swaps }) = &mut task.details {
|
||||||
for (lhs, rhs) in swaps.iter_mut() {
|
for (lhs, rhs) in swaps.iter_mut() {
|
||||||
|
@ -42,7 +42,7 @@ impl Task {
|
|||||||
|
|
||||||
match &self.kind {
|
match &self.kind {
|
||||||
DumpCreation { .. }
|
DumpCreation { .. }
|
||||||
| Snapshot
|
| SnapshotCreation
|
||||||
| TaskCancelation { .. }
|
| TaskCancelation { .. }
|
||||||
| TaskDeletion { .. }
|
| TaskDeletion { .. }
|
||||||
| IndexSwap { .. } => None,
|
| IndexSwap { .. } => None,
|
||||||
@ -77,7 +77,7 @@ impl Task {
|
|||||||
| KindWithContent::TaskCancelation { .. }
|
| KindWithContent::TaskCancelation { .. }
|
||||||
| KindWithContent::TaskDeletion { .. }
|
| KindWithContent::TaskDeletion { .. }
|
||||||
| KindWithContent::DumpCreation { .. }
|
| KindWithContent::DumpCreation { .. }
|
||||||
| KindWithContent::Snapshot => None,
|
| KindWithContent::SnapshotCreation => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ pub enum KindWithContent {
|
|||||||
keys: Vec<Key>,
|
keys: Vec<Key>,
|
||||||
instance_uid: Option<InstanceUid>,
|
instance_uid: Option<InstanceUid>,
|
||||||
},
|
},
|
||||||
Snapshot,
|
SnapshotCreation,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KindWithContent {
|
impl KindWithContent {
|
||||||
@ -150,7 +150,7 @@ impl KindWithContent {
|
|||||||
KindWithContent::TaskCancelation { .. } => Kind::TaskCancelation,
|
KindWithContent::TaskCancelation { .. } => Kind::TaskCancelation,
|
||||||
KindWithContent::TaskDeletion { .. } => Kind::TaskDeletion,
|
KindWithContent::TaskDeletion { .. } => Kind::TaskDeletion,
|
||||||
KindWithContent::DumpCreation { .. } => Kind::DumpCreation,
|
KindWithContent::DumpCreation { .. } => Kind::DumpCreation,
|
||||||
KindWithContent::Snapshot => Kind::Snapshot,
|
KindWithContent::SnapshotCreation => Kind::SnapshotCreation,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,10 @@ impl KindWithContent {
|
|||||||
use KindWithContent::*;
|
use KindWithContent::*;
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
DumpCreation { .. } | Snapshot | TaskCancelation { .. } | TaskDeletion { .. } => vec![],
|
DumpCreation { .. }
|
||||||
|
| SnapshotCreation
|
||||||
|
| TaskCancelation { .. }
|
||||||
|
| TaskDeletion { .. } => vec![],
|
||||||
DocumentAdditionOrUpdate { index_uid, .. }
|
DocumentAdditionOrUpdate { index_uid, .. }
|
||||||
| DocumentDeletion { index_uid, .. }
|
| DocumentDeletion { index_uid, .. }
|
||||||
| DocumentClear { index_uid }
|
| DocumentClear { index_uid }
|
||||||
@ -218,7 +221,7 @@ impl KindWithContent {
|
|||||||
original_query: query.clone(),
|
original_query: query.clone(),
|
||||||
}),
|
}),
|
||||||
KindWithContent::DumpCreation { .. } => None,
|
KindWithContent::DumpCreation { .. } => None,
|
||||||
KindWithContent::Snapshot => None,
|
KindWithContent::SnapshotCreation => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +264,7 @@ impl KindWithContent {
|
|||||||
original_query: query.clone(),
|
original_query: query.clone(),
|
||||||
}),
|
}),
|
||||||
KindWithContent::DumpCreation { .. } => None,
|
KindWithContent::DumpCreation { .. } => None,
|
||||||
KindWithContent::Snapshot => None,
|
KindWithContent::SnapshotCreation => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,7 +304,7 @@ impl From<&KindWithContent> for Option<Details> {
|
|||||||
KindWithContent::DumpCreation { dump_uid, .. } => {
|
KindWithContent::DumpCreation { dump_uid, .. } => {
|
||||||
Some(Details::Dump { dump_uid: dump_uid.clone() })
|
Some(Details::Dump { dump_uid: dump_uid.clone() })
|
||||||
}
|
}
|
||||||
KindWithContent::Snapshot => None,
|
KindWithContent::SnapshotCreation => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +374,7 @@ pub enum Kind {
|
|||||||
TaskCancelation,
|
TaskCancelation,
|
||||||
TaskDeletion,
|
TaskDeletion,
|
||||||
DumpCreation,
|
DumpCreation,
|
||||||
Snapshot,
|
SnapshotCreation,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for Kind {
|
impl FromStr for Kind {
|
||||||
@ -396,6 +399,8 @@ impl FromStr for Kind {
|
|||||||
Ok(Kind::TaskDeletion)
|
Ok(Kind::TaskDeletion)
|
||||||
} else if kind.eq_ignore_ascii_case("dumpCreation") {
|
} else if kind.eq_ignore_ascii_case("dumpCreation") {
|
||||||
Ok(Kind::DumpCreation)
|
Ok(Kind::DumpCreation)
|
||||||
|
} else if kind.eq_ignore_ascii_case("snapshotCreation") {
|
||||||
|
Ok(Kind::SnapshotCreation)
|
||||||
} else {
|
} else {
|
||||||
Err(ResponseError::from_msg(
|
Err(ResponseError::from_msg(
|
||||||
format!(
|
format!(
|
||||||
|
Loading…
Reference in New Issue
Block a user