Implement the IndexUpdate batch operation

This commit is contained in:
Kerollmops 2022-10-04 11:51:39 +02:00 committed by Clément Renault
parent 0543cba6eb
commit da363a92ac
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -410,6 +410,21 @@ impl IndexScheduler {
} => { } => {
let mut wtxn = self.env.write_txn()?; let mut wtxn = self.env.write_txn()?;
let index = self.index_mapper.create_index(&mut wtxn, &index_uid)?; 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 { if let Some(primary_key) = primary_key {
let mut index_wtxn = index.write_txn()?; let mut index_wtxn = index.write_txn()?;
@ -423,15 +438,8 @@ impl IndexScheduler {
index_wtxn.commit()?; index_wtxn.commit()?;
} }
wtxn.commit()?;
Ok(vec![task]) Ok(vec![task])
} }
Batch::IndexUpdate {
index_uid,
primary_key,
task,
} => todo!(),
Batch::IndexDeletion { index_uid, tasks } => todo!(), Batch::IndexDeletion { index_uid, tasks } => todo!(),
} }
} }