mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
write most of the run loop
This commit is contained in:
parent
4846a7c501
commit
1ea9c0b4c0
3 changed files with 80 additions and 35 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue