From 6b2016b350d6ea7e8ffd79cb6f278578b5a9c7d7 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Wed, 25 May 2022 14:39:07 +0200 Subject: [PATCH] remove typo in BatchContent variant --- meilisearch-lib/src/tasks/batch.rs | 8 ++++---- .../src/tasks/handlers/index_resolver_handler.rs | 8 ++++---- meilisearch-lib/src/tasks/handlers/mod.rs | 2 +- meilisearch-lib/src/tasks/scheduler.rs | 4 ++-- meilisearch-lib/src/tasks/task_store/mod.rs | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/meilisearch-lib/src/tasks/batch.rs b/meilisearch-lib/src/tasks/batch.rs index 88c73e3de..d5116f750 100644 --- a/meilisearch-lib/src/tasks/batch.rs +++ b/meilisearch-lib/src/tasks/batch.rs @@ -8,7 +8,7 @@ pub type BatchId = u64; #[derive(Debug)] pub enum BatchContent { - DocumentAddtitionBatch(Vec), + DocumentsAdditionBatch(Vec), IndexUpdate(Task), Dump(Task), Snapshot(SnapshotJob), @@ -19,7 +19,7 @@ pub enum BatchContent { impl BatchContent { pub fn first(&self) -> Option<&Task> { match self { - BatchContent::DocumentAddtitionBatch(ts) => ts.first(), + BatchContent::DocumentsAdditionBatch(ts) => ts.first(), BatchContent::Dump(t) | BatchContent::IndexUpdate(t) => Some(t), BatchContent::Snapshot(_) | BatchContent::Empty => None, } @@ -27,7 +27,7 @@ impl BatchContent { pub fn push_event(&mut self, event: TaskEvent) { match self { - BatchContent::DocumentAddtitionBatch(ts) => { + BatchContent::DocumentsAdditionBatch(ts) => { ts.iter_mut().for_each(|t| t.events.push(event.clone())) } BatchContent::IndexUpdate(t) | BatchContent::Dump(t) => t.events.push(event), @@ -55,7 +55,7 @@ impl Batch { } pub fn len(&self) -> usize { match self.content { - BatchContent::DocumentAddtitionBatch(ref ts) => ts.len(), + BatchContent::DocumentsAdditionBatch(ref ts) => ts.len(), BatchContent::IndexUpdate(_) | BatchContent::Dump(_) | BatchContent::Snapshot(_) => 1, BatchContent::Empty => 0, } diff --git a/meilisearch-lib/src/tasks/handlers/index_resolver_handler.rs b/meilisearch-lib/src/tasks/handlers/index_resolver_handler.rs index 38c079baa..a744dcaad 100644 --- a/meilisearch-lib/src/tasks/handlers/index_resolver_handler.rs +++ b/meilisearch-lib/src/tasks/handlers/index_resolver_handler.rs @@ -14,14 +14,14 @@ where { fn accept(&self, batch: &Batch) -> bool { match batch.content { - BatchContent::DocumentAddtitionBatch(_) | BatchContent::IndexUpdate(_) => true, + BatchContent::DocumentsAdditionBatch(_) | BatchContent::IndexUpdate(_) => true, _ => false, } } async fn process_batch(&self, mut batch: Batch) -> Batch { match batch.content { - BatchContent::DocumentAddtitionBatch(ref mut tasks) => { + BatchContent::DocumentsAdditionBatch(ref mut tasks) => { *tasks = self .process_document_addition_batch(std::mem::take(tasks)) .await; @@ -45,7 +45,7 @@ where } async fn finish(&self, batch: &Batch) { - if let BatchContent::DocumentAddtitionBatch(ref tasks) = batch.content { + if let BatchContent::DocumentsAdditionBatch(ref tasks) = batch.content { for task in tasks { if let Some(content_uuid) = task.get_content_uuid() { if let Err(e) = self.file_store.delete(content_uuid).await { @@ -86,7 +86,7 @@ mod test { let index_resolver = IndexResolver::new(meta_store, index_store, update_file_store); match batch.content { - BatchContent::DocumentAddtitionBatch(_) + BatchContent::DocumentsAdditionBatch(_) | BatchContent::IndexUpdate(_) => assert!(index_resolver.accept(&batch)), BatchContent::Dump(_) | BatchContent::Snapshot(_) diff --git a/meilisearch-lib/src/tasks/handlers/mod.rs b/meilisearch-lib/src/tasks/handlers/mod.rs index f5fe8eaf2..6e28636ed 100644 --- a/meilisearch-lib/src/tasks/handlers/mod.rs +++ b/meilisearch-lib/src/tasks/handlers/mod.rs @@ -15,7 +15,7 @@ mod test { pub fn task_to_batch(task: Task) -> Batch { let content = match task.content { TaskContent::DocumentAddition { .. } => { - BatchContent::DocumentAddtitionBatch(vec![task]) + BatchContent::DocumentsAdditionBatch(vec![task]) } TaskContent::DocumentDeletion(_) | TaskContent::SettingsUpdate { .. } diff --git a/meilisearch-lib/src/tasks/scheduler.rs b/meilisearch-lib/src/tasks/scheduler.rs index 8510ba771..cf3b14cd4 100644 --- a/meilisearch-lib/src/tasks/scheduler.rs +++ b/meilisearch-lib/src/tasks/scheduler.rs @@ -296,9 +296,9 @@ impl Scheduler { pub async fn update_tasks(&self, content: BatchContent) -> Result { match content { - BatchContent::DocumentAddtitionBatch(tasks) => { + BatchContent::DocumentsAdditionBatch(tasks) => { let tasks = self.store.update_tasks(tasks).await?; - Ok(BatchContent::DocumentAddtitionBatch(tasks)) + Ok(BatchContent::DocumentsAdditionBatch(tasks)) } BatchContent::IndexUpdate(t) => { let mut tasks = self.store.update_tasks(vec![t]).await?; diff --git a/meilisearch-lib/src/tasks/task_store/mod.rs b/meilisearch-lib/src/tasks/task_store/mod.rs index 610a5bdeb..a5227fe73 100644 --- a/meilisearch-lib/src/tasks/task_store/mod.rs +++ b/meilisearch-lib/src/tasks/task_store/mod.rs @@ -147,7 +147,7 @@ impl TaskStore { .ok_or(TaskError::UnexistingTask(*id))?; tasks.push(task); } - BatchContent::DocumentAddtitionBatch(tasks) + BatchContent::DocumentsAdditionBatch(tasks) } Processing::IndexUpdate(id) => { let task = store.get(&txn, id)?.ok_or(TaskError::UnexistingTask(id))?;