mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 10:07:40 +08:00
Add MSP to document_update.into_changes()
This commit is contained in:
parent
35bbe1c2a2
commit
84600a10d1
@ -1343,6 +1343,7 @@ impl IndexScheduler {
|
|||||||
&rtxn,
|
&rtxn,
|
||||||
primary_key.as_deref(),
|
primary_key.as_deref(),
|
||||||
&mut new_fields_ids_map,
|
&mut new_fields_ids_map,
|
||||||
|
&|| must_stop_processing.get(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let mut addition = 0;
|
let mut addition = 0;
|
||||||
|
@ -41,14 +41,18 @@ impl<'pl> DocumentOperation<'pl> {
|
|||||||
self.operations.push(Payload::Deletion(to_delete))
|
self.operations.push(Payload::Deletion(to_delete))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_changes(
|
pub fn into_changes<MSP>(
|
||||||
self,
|
self,
|
||||||
indexer: &'pl Bump,
|
indexer: &'pl Bump,
|
||||||
index: &Index,
|
index: &Index,
|
||||||
rtxn: &'pl RoTxn<'pl>,
|
rtxn: &'pl RoTxn<'pl>,
|
||||||
primary_key_from_op: Option<&'pl str>,
|
primary_key_from_op: Option<&'pl str>,
|
||||||
new_fields_ids_map: &mut FieldsIdsMap,
|
new_fields_ids_map: &mut FieldsIdsMap,
|
||||||
) -> Result<(DocumentOperationChanges<'pl>, Vec<PayloadStats>, Option<PrimaryKey<'pl>>)> {
|
must_stop_processing: &MSP,
|
||||||
|
) -> Result<(DocumentOperationChanges<'pl>, Vec<PayloadStats>, Option<PrimaryKey<'pl>>)>
|
||||||
|
where
|
||||||
|
MSP: Fn() -> bool,
|
||||||
|
{
|
||||||
let Self { operations, method } = self;
|
let Self { operations, method } = self;
|
||||||
|
|
||||||
let documents_ids = index.documents_ids(rtxn)?;
|
let documents_ids = index.documents_ids(rtxn)?;
|
||||||
@ -58,6 +62,9 @@ impl<'pl> DocumentOperation<'pl> {
|
|||||||
let mut primary_key = None;
|
let mut primary_key = None;
|
||||||
|
|
||||||
for operation in operations {
|
for operation in operations {
|
||||||
|
if (must_stop_processing)() {
|
||||||
|
return Err(InternalError::AbortedIndexation.into());
|
||||||
|
}
|
||||||
let mut bytes = 0;
|
let mut bytes = 0;
|
||||||
let result = match operation {
|
let result = match operation {
|
||||||
Payload::Addition(payload) => extract_addition_payload_changes(
|
Payload::Addition(payload) => extract_addition_payload_changes(
|
||||||
|
Loading…
Reference in New Issue
Block a user