From 2b6952eda12d0d0a6f79e2c5765672efc9835c51 Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 19 Sep 2024 10:35:17 +0200 Subject: [PATCH] rename the ArroyReader to an ArroyWrapper since it can read and write --- milli/src/index.rs | 8 ++++---- milli/src/update/index_documents/mod.rs | 6 +++--- milli/src/update/index_documents/transform.rs | 4 ++-- milli/src/update/index_documents/typed_chunk.rs | 4 ++-- milli/src/vector/mod.rs | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/milli/src/index.rs b/milli/src/index.rs index 9b06e9645..2dd6c6541 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -21,7 +21,7 @@ use crate::heed_codec::{BEU16StrCodec, FstSetCodec, StrBEU16Codec, StrRefCodec}; use crate::order_by_map::OrderByMap; use crate::proximity::ProximityPrecision; use crate::vector::parsed_vectors::RESERVED_VECTORS_FIELD_NAME; -use crate::vector::{ArroyReader, Embedding, EmbeddingConfig}; +use crate::vector::{ArroyWrapper, Embedding, EmbeddingConfig}; use crate::{ default_criteria, CboRoaringBitmapCodec, Criterion, DocumentId, ExternalDocumentsIds, FacetDistribution, FieldDistribution, FieldId, FieldIdMapMissingEntry, FieldIdWordCountCodec, @@ -1615,9 +1615,9 @@ impl Index { rtxn: &'a RoTxn<'a>, embedder_id: u8, quantized: bool, - ) -> impl Iterator> + 'a { + ) -> impl Iterator> + 'a { crate::vector::arroy_db_range_for_embedder(embedder_id).map_while(move |k| { - let reader = ArroyReader::new(self.vector_arroy, k, quantized); + let reader = ArroyWrapper::new(self.vector_arroy, k, quantized); // Here we don't care about the dimensions, but we want to know if we can read // in the database or if its medata are missing. match reader.dimensions(rtxn) { @@ -1654,7 +1654,7 @@ impl Index { let mut embeddings = Vec::new(); 'vectors: for i in 0..=u8::MAX { - let reader = ArroyReader::new( + let reader = ArroyWrapper::new( self.vector_arroy, embedder_id | (i as u16), config.config.quantized(), diff --git a/milli/src/update/index_documents/mod.rs b/milli/src/update/index_documents/mod.rs index 29530a0bb..d8566582c 100644 --- a/milli/src/update/index_documents/mod.rs +++ b/milli/src/update/index_documents/mod.rs @@ -43,7 +43,7 @@ use crate::update::index_documents::parallel::ImmutableObkvs; use crate::update::{ IndexerConfig, UpdateIndexingStep, WordPrefixDocids, WordPrefixIntegerDocids, WordsPrefixesFst, }; -use crate::vector::{ArroyReader, EmbeddingConfigs}; +use crate::vector::{ArroyWrapper, EmbeddingConfigs}; use crate::{CboRoaringBitmapCodec, Index, Object, Result}; static MERGED_DATABASE_COUNT: usize = 7; @@ -691,7 +691,7 @@ where )?; let first_id = crate::vector::arroy_db_range_for_embedder(index).next().unwrap(); let reader = - ArroyReader::new(self.index.vector_arroy, first_id, action.was_quantized); + ArroyWrapper::new(self.index.vector_arroy, first_id, action.was_quantized); let dim = reader.dimensions(self.wtxn)?; dimension.insert(name.to_string(), dim); } @@ -710,7 +710,7 @@ where pool.install(|| { for k in crate::vector::arroy_db_range_for_embedder(embedder_index) { - let mut writer = ArroyReader::new(vector_arroy, k, was_quantized); + let mut writer = ArroyWrapper::new(vector_arroy, k, was_quantized); if is_quantizing { writer.quantize(wtxn, k, dimension)?; } diff --git a/milli/src/update/index_documents/transform.rs b/milli/src/update/index_documents/transform.rs index b1a5e4b2d..bb2cfe56c 100644 --- a/milli/src/update/index_documents/transform.rs +++ b/milli/src/update/index_documents/transform.rs @@ -29,7 +29,7 @@ use crate::update::settings::{InnerIndexSettings, InnerIndexSettingsDiff}; use crate::update::{AvailableDocumentsIds, UpdateIndexingStep}; use crate::vector::parsed_vectors::{ExplicitVectors, VectorOrArrayOfVectors}; use crate::vector::settings::WriteBackToDocuments; -use crate::vector::ArroyReader; +use crate::vector::ArroyWrapper; use crate::{ is_faceted_by, FieldDistribution, FieldId, FieldIdMapMissingEntry, FieldsIdsMap, Index, Result, }; @@ -990,7 +990,7 @@ impl<'a, 'i> Transform<'a, 'i> { None }; - let readers: Result, &RoaringBitmap)>> = settings_diff + let readers: Result, &RoaringBitmap)>> = settings_diff .embedding_config_updates .iter() .filter_map(|(name, action)| { diff --git a/milli/src/update/index_documents/typed_chunk.rs b/milli/src/update/index_documents/typed_chunk.rs index b133f7a87..90e49d23b 100644 --- a/milli/src/update/index_documents/typed_chunk.rs +++ b/milli/src/update/index_documents/typed_chunk.rs @@ -27,7 +27,7 @@ use crate::update::index_documents::helpers::{ as_cloneable_grenad, keep_latest_obkv, try_split_array_at, }; use crate::update::settings::InnerIndexSettingsDiff; -use crate::vector::ArroyReader; +use crate::vector::ArroyWrapper; use crate::{ lat_lng_to_xyz, CboRoaringBitmapCodec, DocumentId, FieldId, GeoPoint, Index, InternalError, Result, SerializationError, U8StrStrCodec, @@ -673,7 +673,7 @@ pub(crate) fn write_typed_chunk_into_index( .map_or(false, |conf| conf.was_quantized); // FIXME: allow customizing distance let writers: Vec<_> = crate::vector::arroy_db_range_for_embedder(embedder_index) - .map(|k| ArroyReader::new(index.vector_arroy, k, binary_quantized)) + .map(|k| ArroyWrapper::new(index.vector_arroy, k, binary_quantized)) .collect(); // remove vectors for docids we want them removed diff --git a/milli/src/vector/mod.rs b/milli/src/vector/mod.rs index edda59121..d52e68bbe 100644 --- a/milli/src/vector/mod.rs +++ b/milli/src/vector/mod.rs @@ -30,13 +30,13 @@ pub type Embedding = Vec; pub const REQUEST_PARALLELISM: usize = 40; -pub struct ArroyReader { +pub struct ArroyWrapper { quantized: bool, index: u16, database: arroy::Database, } -impl ArroyReader { +impl ArroyWrapper { pub fn new(database: arroy::Database, index: u16, quantized: bool) -> Self { Self { database, index, quantized } }