From da363a92acc7ed54a6bcaad8d6eb1b64d437d316 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 4 Oct 2022 11:51:39 +0200 Subject: [PATCH] Implement the IndexUpdate batch operation --- index-scheduler/src/batch.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index a597f4161..76933343d 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -410,6 +410,21 @@ impl IndexScheduler { } => { let mut wtxn = self.env.write_txn()?; let index = self.index_mapper.create_index(&mut wtxn, &index_uid)?; + wtxn.commit()?; + + self.process_batch(Batch::IndexUpdate { + index_uid, + primary_key, + task, + }) + } + Batch::IndexUpdate { + index_uid, + primary_key, + task, + } => { + let rtxn = self.env.read_txn()?; + let index = self.index_mapper.index(&rtxn, &index_uid)?; if let Some(primary_key) = primary_key { let mut index_wtxn = index.write_txn()?; @@ -423,15 +438,8 @@ impl IndexScheduler { index_wtxn.commit()?; } - wtxn.commit()?; - Ok(vec![task]) } - Batch::IndexUpdate { - index_uid, - primary_key, - task, - } => todo!(), Batch::IndexDeletion { index_uid, tasks } => todo!(), } }