mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 00:31:02 +00:00
write most of the run loop
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
autobatcher::BatchKind,
|
||||
task::{Kind, KindWithContent, Status, Task},
|
||||
Error, IndexScheduler, Result,
|
||||
Error, IndexScheduler, Result, TaskId,
|
||||
};
|
||||
use index::{Settings, Unchecked};
|
||||
use milli::{
|
||||
@ -33,6 +33,26 @@ pub(crate) enum Batch {
|
||||
},
|
||||
}
|
||||
|
||||
impl Batch {
|
||||
pub fn ids(&self) -> Vec<TaskId> {
|
||||
match self {
|
||||
Batch::Cancel(task) => vec![task.uid],
|
||||
Batch::Snapshot(tasks) | Batch::Dump(tasks) | Batch::DocumentAddition { tasks, .. } => {
|
||||
tasks.iter().map(|task| task.uid).collect()
|
||||
}
|
||||
Batch::SettingsAndDocumentAddition {
|
||||
document_addition_tasks,
|
||||
settings_tasks,
|
||||
..
|
||||
} => document_addition_tasks
|
||||
.iter()
|
||||
.chain(settings_tasks)
|
||||
.map(|task| task.uid)
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl IndexScheduler {
|
||||
pub(crate) fn create_next_batch_index(
|
||||
&self,
|
||||
|
Reference in New Issue
Block a user