From 43a19d07094a9b5c81afab0cb2b3026dadc1a66d Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 14 Feb 2023 17:55:26 +0100 Subject: [PATCH] document the operation enum + the grenads --- milli/src/update/index_documents/transform.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/milli/src/update/index_documents/transform.rs b/milli/src/update/index_documents/transform.rs index 73c734aaa..05e7089b7 100644 --- a/milli/src/update/index_documents/transform.rs +++ b/milli/src/update/index_documents/transform.rs @@ -50,8 +50,12 @@ pub struct Transform<'a, 'i> { pub index_documents_method: IndexDocumentsMethod, available_documents_ids: AvailableDocumentsIds, + // Both grenad follows the same format: + // key | value + // u32 | 1 byte for the Operation byte, the rest is the obkv of the document stored original_sorter: grenad::Sorter, flattened_sorter: grenad::Sorter, + replaced_documents_ids: RoaringBitmap, new_documents_ids: RoaringBitmap, // To increase the cache locality and decrease the heap usage we use compact smartstring. @@ -59,6 +63,8 @@ pub struct Transform<'a, 'i> { documents_count: usize, } +/// This enum is specific to the grenad sorter stored in the transform. +/// It's used as the first byte of the grenads and tells you if the document id was an addition or a deletion. #[repr(u8)] enum Operation { Addition,