From bc5ff2acd7dcf7cc0fef14b1fab0f869ef85fbfb Mon Sep 17 00:00:00 2001 From: Arnaud Gourlay Date: Tue, 7 Jul 2026 16:25:57 +0200 Subject: [PATCH] Remove dead code (#9719) --- Cargo.lock | 1 - lib/collection/src/shards/mod.rs | 2 - lib/collection/src/shards/shard_trait.rs | 2 - lib/common/common/src/counter/counter_cell.rs | 6 - .../src/counter/iterator_hw_measurement.rs | 16 -- .../common/src/iterator_ext/fallible.rs | 20 -- lib/common/common/src/iterator_ext/mod.rs | 2 +- lib/common/common/src/tar_ext.rs | 8 - lib/gridstore/src/config.rs | 2 - lib/posting_list/src/lib.rs | 3 - .../src/index/bitmap_filter_context.rs | 44 --- .../geo_index/mutable_geo_index/lifecycle.rs | 8 - .../src/index/field_index/map_index/mod.rs | 1 - .../field_index/numeric_index/encodable.rs | 91 +----- .../src/index/hnsw_index/graph_layers.rs | 3 - lib/segment/src/index/key_encoding.rs | 265 ------------------ lib/segment/src/index/mod.rs | 1 - lib/segment/src/types.rs | 17 -- .../inverted_index/inverted_index_ram.rs | 7 - .../content_manager/toc/temp_directories.rs | 4 - lib/trififo/Cargo.toml | 3 - 21 files changed, 8 insertions(+), 498 deletions(-) delete mode 100644 lib/segment/src/index/bitmap_filter_context.rs delete mode 100644 lib/segment/src/index/key_encoding.rs diff --git a/Cargo.lock b/Cargo.lock index fc60447759..c90351d09e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8372,7 +8372,6 @@ dependencies = [ name = "trififo" version = "0.0.0" dependencies = [ - "ahash", "cap", "criterion", "foyer", diff --git a/lib/collection/src/shards/mod.rs b/lib/collection/src/shards/mod.rs index 308def3d7a..df3177ac75 100644 --- a/lib/collection/src/shards/mod.rs +++ b/lib/collection/src/shards/mod.rs @@ -35,8 +35,6 @@ use crate::shards::shard_config::ShardConfig; pub type CollectionId = String; -pub type ShardVersion = usize; - /// Path to a shard directory pub fn shard_path(collection_path: &Path, shard_id: ShardId) -> PathBuf { collection_path.join(shard_id.to_string()) diff --git a/lib/collection/src/shards/shard_trait.rs b/lib/collection/src/shards/shard_trait.rs index 3cb463ab9b..de7953e6c4 100644 --- a/lib/collection/src/shards/shard_trait.rs +++ b/lib/collection/src/shards/shard_trait.rs @@ -170,5 +170,3 @@ pub trait ShardOperation { /// and wait till they are finished. async fn stop_gracefully(self); } - -pub type ShardOperationSS = dyn ShardOperation + Send + Sync; diff --git a/lib/common/common/src/counter/counter_cell.rs b/lib/common/common/src/counter/counter_cell.rs index 3e9f215c47..f6f3a2a0e2 100644 --- a/lib/common/common/src/counter/counter_cell.rs +++ b/lib/common/common/src/counter/counter_cell.rs @@ -47,12 +47,6 @@ impl CounterCell { self.set(self.get() + delta); } - /// Multiply the counters value by `amount`. - #[inline] - pub fn multiplied(&self, amount: usize) { - self.set(self.get() * amount) - } - /// Resets the counter to 0. pub fn clear(&self) { self.counter.set(0); diff --git a/lib/common/common/src/counter/iterator_hw_measurement.rs b/lib/common/common/src/counter/iterator_hw_measurement.rs index b3c33de481..10eb3bd238 100644 --- a/lib/common/common/src/counter/iterator_hw_measurement.rs +++ b/lib/common/common/src/counter/iterator_hw_measurement.rs @@ -85,22 +85,6 @@ pub trait HwMeasurementIteratorExt: Iterator { f(&hw_counter).incr_delta(total_count / fraction); }) } - - /// Measures the hardware usage of an iterator with the size of a single value being represented as a fraction. - fn measure_hw_with_cell_and_fraction( - self, - hw_cell: &HardwareCounterCell, - fraction: usize, - mut f: R, - ) -> OnFinalCount - where - Self: Sized, - R: FnMut(&HardwareCounterCell) -> &CounterCell, - { - OnFinalCount::new(self, move |total_count| { - f(hw_cell).incr_delta(total_count / fraction); - }) - } } impl HwMeasurementIteratorExt for I {} diff --git a/lib/common/common/src/iterator_ext/fallible.rs b/lib/common/common/src/iterator_ext/fallible.rs index 94c302a36d..e758713d77 100644 --- a/lib/common/common/src/iterator_ext/fallible.rs +++ b/lib/common/common/src/iterator_ext/fallible.rs @@ -2,10 +2,8 @@ use std::collections::hash_map::Entry; use std::hash::Hash; -use std::iter::{Once, once}; use ahash::AHashMap; -use itertools::Either; pub trait FallibleIteratorExt: Iterator + Sized { /// Like [`itertools::Itertools::unique`], but for iterators over [`Result`]. @@ -38,24 +36,6 @@ impl FallibleIteratorExt for I { } } -pub trait TransposeResultIter { - /// Convert `Result>, E>` - /// into `Iterator>` - fn into_result_iter(self) -> Either>>; -} - -impl TransposeResultIter for Result -where - I: Iterator>, -{ - fn into_result_iter(self) -> Either>> { - match self { - Ok(iter) => Either::Left(iter), - Err(err) => Either::Right(once(Err(err))), - } - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/lib/common/common/src/iterator_ext/mod.rs b/lib/common/common/src/iterator_ext/mod.rs index 99aceba188..4dc06b8020 100644 --- a/lib/common/common/src/iterator_ext/mod.rs +++ b/lib/common/common/src/iterator_ext/mod.rs @@ -14,7 +14,7 @@ mod fallible; pub mod ordering_iterator; pub mod stoppable_iter; -pub use fallible::{FallibleIteratorExt, TransposeResultIter}; +pub use fallible::FallibleIteratorExt; pub trait IteratorExt: Iterator { /// Periodically check if the iteration should be stopped. diff --git a/lib/common/common/src/tar_ext.rs b/lib/common/common/src/tar_ext.rs index b1d86ee074..5ceb3d110d 100644 --- a/lib/common/common/src/tar_ext.rs +++ b/lib/common/common/src/tar_ext.rs @@ -227,14 +227,6 @@ impl BuilderExt { } impl BuilderExt { - /// Append a file to the tar archive. - pub async fn append_file(&self, src: &Path, dst: &Path) -> io::Result<()> { - let src = src.to_path_buf(); - let dst = join_relative(&self.path, dst)?; - self.run_async(move |tar| tar.append_path_with_name(src, dst)) - .await - } - /// Append a new entry to the tar archive with the given file contents. /// /// # Panics diff --git a/lib/gridstore/src/config.rs b/lib/gridstore/src/config.rs index 2bea95e0ec..b631f45d2e 100644 --- a/lib/gridstore/src/config.rs +++ b/lib/gridstore/src/config.rs @@ -9,8 +9,6 @@ pub const DEFAULT_PAGE_SIZE_BYTES: usize = 32 * 1024 * 1024; // 32MB pub const DEFAULT_REGION_SIZE_BLOCKS: usize = 8_192; -pub const DEFAULT_USE_COMPRESSION: bool = true; - #[derive(Debug, Copy, Clone, Serialize, Deserialize, Default)] pub enum Compression { None, diff --git a/lib/posting_list/src/lib.rs b/lib/posting_list/src/lib.rs index f83408593f..82aeed5fa6 100644 --- a/lib/posting_list/src/lib.rs +++ b/lib/posting_list/src/lib.rs @@ -40,9 +40,6 @@ pub type SizedTypeFor = <::Handler as ValueHandler>::Sized /// Posting list of ids, where ids are compressed. pub type IdsPostingList = PostingList<()>; -/// Non-owning posting list of ids, where ids are compressed. -pub type IdsPostingListView<'a> = PostingListView<'a, ()>; - pub use builder::PostingBuilder; pub use iterator::PostingIterator; pub use posting_list::{PostingChunk, PostingElement, PostingList, RemainderPosting}; diff --git a/lib/segment/src/index/bitmap_filter_context.rs b/lib/segment/src/index/bitmap_filter_context.rs deleted file mode 100644 index 1a4123878a..0000000000 --- a/lib/segment/src/index/bitmap_filter_context.rs +++ /dev/null @@ -1,44 +0,0 @@ -use common::types::PointOffsetType; -use roaring::RoaringBitmap; - -/// A [`FilterContext`] backed by a pre-materialized set of matching points. -/// -/// Built by evaluating a filter once (e.g. collecting -/// [`PayloadIndexRead::iter_filtered_points`]) so that every subsequent -/// [`check`] is a bitmap probe instead of a full per-condition evaluation -/// against the payload indexes. -/// -/// Pays off whenever the same filter would otherwise be checked more than -/// once per point — e.g. facet counting, where every posting-list element of -/// every value is tested against the same filter, and points holding several -/// values are tested once per value. -/// -/// Note that, unlike the lazy `StructFilterContext`, the set is fixed at -/// construction time: whatever visibility rules (deleted points, deferred -/// cutoff) the producing iterator applied are baked in. -/// -/// [`PayloadIndexRead::iter_filtered_points`]: crate::index::PayloadIndexRead::iter_filtered_points -/// [`check`]: FilterContext::check -pub struct BitmapFilterContext(RoaringBitmap); - -impl BitmapFilterContext { - /// Whether `point_id` matched the filter. - pub fn check(&self, point_id: PointOffsetType) -> bool { - self.0.contains(point_id) - } - - /// Number of points matching the materialized filter. - pub fn len(&self) -> usize { - self.0.len() as usize - } - - pub fn is_empty(&self) -> bool { - self.0.is_empty() - } -} - -impl FromIterator for BitmapFilterContext { - fn from_iter>(iter: I) -> Self { - Self(RoaringBitmap::from_iter(iter)) - } -} diff --git a/lib/segment/src/index/field_index/geo_index/mutable_geo_index/lifecycle.rs b/lib/segment/src/index/field_index/geo_index/mutable_geo_index/lifecycle.rs index 5cc2129c5e..c725c645b8 100644 --- a/lib/segment/src/index/field_index/geo_index/mutable_geo_index/lifecycle.rs +++ b/lib/segment/src/index/field_index/geo_index/mutable_geo_index/lifecycle.rs @@ -74,14 +74,6 @@ impl MutableGeoIndex { })) } - #[expect(dead_code)] // FIXME(rocksdb): leftover after removing rocksdb - #[inline] - pub(in super::super) fn clear(&mut self) -> OperationResult<()> { - self.storage.clear().map_err(|err| { - OperationError::service_error(format!("Failed to clear mutable geo index: {err}")) - }) - } - #[inline] pub(in super::super) fn wipe(self) -> OperationResult<()> { self.storage.wipe().map_err(|err| { diff --git a/lib/segment/src/index/field_index/map_index/mod.rs b/lib/segment/src/index/field_index/map_index/mod.rs index 7f7e93e83b..a2bfff5246 100644 --- a/lib/segment/src/index/field_index/map_index/mod.rs +++ b/lib/segment/src/index/field_index/map_index/mod.rs @@ -30,7 +30,6 @@ pub mod read_only; /// - "some", "text", "here" - 16 bytes pub(super) const BLOCK_SIZE_KEYWORD: usize = 16; -pub type IdRefIter<'a> = Box + 'a>; pub type IdIter<'a> = Box + 'a>; pub enum MapIndex diff --git a/lib/segment/src/index/field_index/numeric_index/encodable.rs b/lib/segment/src/index/field_index/numeric_index/encodable.rs index 1223c36176..6e93d82aae 100644 --- a/lib/segment/src/index/field_index/numeric_index/encodable.rs +++ b/lib/segment/src/index/field_index/numeric_index/encodable.rs @@ -1,94 +1,17 @@ -//! The [`Encodable`] key-format trait: on-disk key encoding/decoding and -//! encoded-order comparison shared by every numeric-index storage variant. +//! The [`Encodable`] bound shared by every numeric-index storage variant's +//! key type. -use chrono::DateTime; -use common::types::PointOffsetType; use serde::Serialize; use serde::de::DeserializeOwned; -use crate::index::key_encoding::{ - decode_f64_key_ascending, decode_i64_key_ascending, decode_u128_key_ascending, - encode_f64_key_ascending, encode_i64_key_ascending, encode_u128_key_ascending, -}; use crate::types::{DateTimePayloadType, FloatPayloadType, IntPayloadType}; -pub trait Encodable: Copy + Serialize + DeserializeOwned + 'static { - fn encode_key(&self, id: PointOffsetType) -> Vec; +pub trait Encodable: Copy + Serialize + DeserializeOwned + 'static {} - fn decode_key(key: &[u8]) -> (PointOffsetType, Self); +impl Encodable for IntPayloadType {} - fn cmp_encoded(&self, other: &Self) -> std::cmp::Ordering; -} +impl Encodable for u128 {} -impl Encodable for IntPayloadType { - fn encode_key(&self, id: PointOffsetType) -> Vec { - encode_i64_key_ascending(*self, id) - } +impl Encodable for FloatPayloadType {} - fn decode_key(key: &[u8]) -> (PointOffsetType, Self) { - decode_i64_key_ascending(key) - } - - fn cmp_encoded(&self, other: &Self) -> std::cmp::Ordering { - self.cmp(other) - } -} - -impl Encodable for u128 { - fn encode_key(&self, id: PointOffsetType) -> Vec { - encode_u128_key_ascending(*self, id) - } - - fn decode_key(key: &[u8]) -> (PointOffsetType, Self) { - decode_u128_key_ascending(key) - } - - fn cmp_encoded(&self, other: &Self) -> std::cmp::Ordering { - self.cmp(other) - } -} - -impl Encodable for FloatPayloadType { - fn encode_key(&self, id: PointOffsetType) -> Vec { - encode_f64_key_ascending(*self, id) - } - - fn decode_key(key: &[u8]) -> (PointOffsetType, Self) { - decode_f64_key_ascending(key) - } - - fn cmp_encoded(&self, other: &Self) -> std::cmp::Ordering { - if self.is_nan() && other.is_nan() { - return std::cmp::Ordering::Equal; - } - if self.is_nan() { - return std::cmp::Ordering::Less; - } - if other.is_nan() { - return std::cmp::Ordering::Greater; - } - self.partial_cmp(other).unwrap() - } -} - -/// Encodes timestamps as i64 in microseconds -impl Encodable for DateTimePayloadType { - fn encode_key(&self, id: PointOffsetType) -> Vec { - encode_i64_key_ascending(self.timestamp(), id) - } - - fn decode_key(key: &[u8]) -> (PointOffsetType, Self) { - let (id, timestamp) = decode_i64_key_ascending(key); - let datetime = - DateTime::from_timestamp(timestamp / 1000, (timestamp % 1000) as u32 * 1_000_000) - .unwrap_or_else(|| { - log::warn!("Failed to decode timestamp {timestamp}, fallback to UNIX_EPOCH"); - DateTime::UNIX_EPOCH - }); - (id, datetime.into()) - } - - fn cmp_encoded(&self, other: &Self) -> std::cmp::Ordering { - self.timestamp().cmp(&other.timestamp()) - } -} +impl Encodable for DateTimePayloadType {} diff --git a/lib/segment/src/index/hnsw_index/graph_layers.rs b/lib/segment/src/index/hnsw_index/graph_layers.rs index 56fa75eedf..d8fe0778d5 100644 --- a/lib/segment/src/index/hnsw_index/graph_layers.rs +++ b/lib/segment/src/index/hnsw_index/graph_layers.rs @@ -52,9 +52,6 @@ use crate::index::visited_pool::{VisitedListHandle, VisitedPool}; use crate::vector_storage::RawScorer; use crate::vector_storage::query_scorer::QueryScorerBytes; -pub type LinkContainer = Vec; -pub type LayersContainer = Vec; - pub const HNSW_GRAPH_FILE: &str = "graph.bin"; pub const HNSW_LINKS_FILE: &str = "links.bin"; diff --git a/lib/segment/src/index/key_encoding.rs b/lib/segment/src/index/key_encoding.rs deleted file mode 100644 index e3ba23ae10..0000000000 --- a/lib/segment/src/index/key_encoding.rs +++ /dev/null @@ -1,265 +0,0 @@ -const FLOAT_NAN: u8 = 0x00; -const FLOAT_NEG: u8 = 0x01; -const FLOAT_ZERO: u8 = 0x02; -const FLOAT_POS: u8 = 0x03; - -const F64_KEY_LEN: usize = 13; -const I64_KEY_LEN: usize = 12; -const U128_KEY_LEN: usize = 20; - -/// Encode a f64 into `buf` -/// -/// The encoded format for a f64 is : -/// -/// **for positives:** the f64 bits ( in IEEE 754 format ) are re-interpreted as an int64 and -/// encoded using big-endian order. -/// -/// **for negative** f64 : invert all the bits and encode it using bit-endian order. -/// -/// A single-byte prefix tag is appended to the front of the encoding slice to ensures that -/// NaNs are always sorted first. -/// -/// This approach was inspired by -/// -/// -/// #f64 encoding format -/// -///```text -/// 0 1 9 -/// ┌───────────────────┬─────────────────┐ -/// │ Float Type │ NEG: !key_val │ -/// │ NAN/NEG/ZERO/POS | POS: key_val │ -/// │ (big-endian) │ (big-endian) │ -/// └───────────────────┴─────────────────┘ -/// ``` -/// -pub fn encode_f64_ascending(val: f64, buf: &mut Vec) { - if val.is_nan() { - buf.push(FLOAT_NAN); - buf.extend([0_u8; std::mem::size_of::()]); - return; - } - - if val == 0f64 { - buf.push(FLOAT_ZERO); - buf.extend([0_u8; std::mem::size_of::()]); - return; - } - - let f_as_u64 = val.to_bits(); - - if f_as_u64 & (1 << 63) != 0 { - let f = !f_as_u64; - buf.push(FLOAT_NEG); - buf.extend(f.to_be_bytes()); - } else { - buf.push(FLOAT_POS); - buf.extend(f_as_u64.to_be_bytes()); - } -} - -/// Decode a f64 from a slice. -pub fn decode_f64_ascending(buf: &[u8]) -> f64 { - match buf[0] { - FLOAT_NAN => f64::NAN, - FLOAT_NEG => { - let u = u64::from_be_bytes(buf[1..9].try_into().expect("cannot decode f64")); - let f = !u; - f64::from_bits(f) - } - FLOAT_ZERO => 0f64, - FLOAT_POS => { - let u = u64::from_be_bytes(buf[1..9].try_into().expect("cannot decode f64")); - f64::from_bits(u) - } - _ => panic!("invalid f64 prefix"), - } -} - -/// Encode a i64 into `buf` so that is sorts ascending. -pub fn encode_i64_ascending(val: i64, buf: &mut Vec) { - let i = val ^ i64::MIN; - buf.extend(i.to_be_bytes()); -} - -/// Decode a i64 from a slice -pub fn decode_i64_ascending(buf: &[u8]) -> i64 { - let i = i64::from_be_bytes(buf[0..8].try_into().expect("cannot decode i64")); - i ^ i64::MIN -} - -/// Encodes a f64 key so that it sort in ascending order. -/// -/// The key is compound by the numeric value of the key plus a u32 representing -/// the payload offset within the payload store. -/// -/// # float key encoding format -/// -///```text -/// -/// 0 1 9 13 -/// ┌───────────────────┬─────────────────┬──────────────┐ -/// │ Float Type │ NEG: !key_val │ │ -/// │ NAN/NEG/ZERO/POS | POS: key_val │ point_offset │ -/// │ (big-endian) │ (big-endian) │ │ -/// └───────────────────┴─────────────────┴──────────────┘ -/// ``` -/// -pub fn encode_f64_key_ascending(key_val: f64, point_offset: u32) -> Vec { - let mut buf = Vec::with_capacity(F64_KEY_LEN); - encode_f64_ascending(key_val, &mut buf); - buf.extend(point_offset.to_be_bytes()); - buf -} - -pub fn decode_f64_key_ascending(buf: &[u8]) -> (u32, f64) { - ( - u32::from_be_bytes( - (&buf[F64_KEY_LEN - std::mem::size_of::()..]) - .try_into() - .unwrap(), - ), - decode_f64_ascending(buf), - ) -} - -/// Encodes a i64 key so that it sort in ascending order. -/// -/// The key is compound by the numeric value of the key plus a u32 representing -/// the payload offset within the payload store. -/// -/// # int key encoding format -/// -///```text -/// -/// 0 8 12 -/// ┌────────────────────┬──────────────┐ -/// │ key_val ^ i64::MIN │ point_offset │ -/// │ (big-endian) │ (big-endian) │ -/// └────────────────────┴──────────────┘ -///``` -pub fn encode_i64_key_ascending(key_val: i64, point_offset: u32) -> Vec { - let mut buf = Vec::with_capacity(I64_KEY_LEN); - encode_i64_ascending(key_val, &mut buf); - buf.extend(point_offset.to_be_bytes()); - buf -} - -pub fn decode_i64_key_ascending(buf: &[u8]) -> (u32, i64) { - ( - u32::from_be_bytes( - (&buf[I64_KEY_LEN - std::mem::size_of::()..]) - .try_into() - .unwrap(), - ), - decode_i64_ascending(buf), - ) -} - -/// Encodes a u128 key so that it sort in ascending order. -/// -/// The key is compound by the numeric value of the key plus a u32 representing -/// the payload offset within the payload store. -/// -/// # int key encoding format -/// -///```text -/// -/// 0 16 20 -/// ┌─────────────────────┬──────────────┐ -/// │ key_val │ point_offset │ -/// │ (big-endian) │ (big-endian) │ -/// └─────────────────────┴──────────────┘ -///``` -pub fn encode_u128_key_ascending(key_val: u128, point_offset: u32) -> Vec { - let mut buf = Vec::with_capacity(U128_KEY_LEN); - buf.extend(key_val.to_be_bytes()); - buf.extend(point_offset.to_be_bytes()); - buf -} - -pub fn decode_u128_key_ascending(buf: &[u8]) -> (u32, u128) { - ( - u32::from_be_bytes( - (&buf[U128_KEY_LEN - std::mem::size_of::()..]) - .try_into() - .unwrap(), - ), - u128::from_be_bytes(buf[0..16].try_into().expect("cannot decode u128")), - ) -} - -#[cfg(test)] -mod tests { - use std::cmp::Ordering; - - use crate::index::key_encoding::{ - decode_f64_ascending, decode_i64_ascending, encode_f64_ascending, encode_i64_ascending, - }; - - #[test] - fn test_encode_f64() { - test_f64_encoding_roundtrip(0.42342); - test_f64_encoding_roundtrip(0f64); - test_f64_encoding_roundtrip(f64::NAN); - test_f64_encoding_roundtrip(-0.423423983); - } - - #[test] - fn test_encode_i64() { - test_i64_encoding_roundtrip(i64::MIN); - test_i64_encoding_roundtrip(i64::MAX); - test_i64_encoding_roundtrip(0); - test_i64_encoding_roundtrip(41262); - test_i64_encoding_roundtrip(-98793); - } - - #[test] - fn test_f64_lex_order() { - let mut nan_buf = Vec::new(); - let mut zero_buf = Vec::new(); - let mut pos_buf = Vec::new(); - let mut neg_buf = Vec::new(); - - encode_f64_ascending(f64::NAN, &mut nan_buf); - encode_f64_ascending(0f64, &mut zero_buf); - encode_f64_ascending(0.2435224412, &mut pos_buf); - encode_f64_ascending(-0.82976347, &mut neg_buf); - - assert_eq!(nan_buf.cmp(&neg_buf), Ordering::Less); - assert_eq!(neg_buf.cmp(&zero_buf), Ordering::Less); - assert_eq!(zero_buf.cmp(&pos_buf), Ordering::Less); - } - - #[test] - fn test_i64_lex_order() { - let mut zero_buf = Vec::new(); - let mut pos_buf = Vec::new(); - let mut neg_buf = Vec::new(); - - encode_i64_ascending(0, &mut zero_buf); - encode_i64_ascending(123, &mut pos_buf); - encode_i64_ascending(-4324, &mut neg_buf); - - assert_eq!(neg_buf.cmp(&zero_buf), Ordering::Less); - assert_eq!(zero_buf.cmp(&pos_buf), Ordering::Less); - } - - fn test_f64_encoding_roundtrip(val: f64) { - let mut buf = Vec::new(); - encode_f64_ascending(val, &mut buf); - let dec_val = decode_f64_ascending(buf.as_slice()); - if val.is_nan() { - assert!(dec_val.is_nan()); - return; - } - assert_eq!(val, dec_val); - } - - fn test_i64_encoding_roundtrip(val: i64) { - let mut buf = Vec::new(); - encode_i64_ascending(val, &mut buf); - let res = decode_i64_ascending(buf.as_slice()); - assert_eq!(val, res); - } -} diff --git a/lib/segment/src/index/mod.rs b/lib/segment/src/index/mod.rs index 78f125fc53..2e0cd17e09 100644 --- a/lib/segment/src/index/mod.rs +++ b/lib/segment/src/index/mod.rs @@ -1,7 +1,6 @@ mod condition_checker; pub mod field_index; pub mod hnsw_index; -mod key_encoding; mod memory_reporter; pub mod payload_config; mod payload_index_base; diff --git a/lib/segment/src/types.rs b/lib/segment/src/types.rs index 2e0decd265..25ffbd8ebf 100644 --- a/lib/segment/src/types.rs +++ b/lib/segment/src/types.rs @@ -2428,23 +2428,6 @@ impl<'a> From<&'a Map> for OwnedPayloadRef<'a> { } } -/// Payload interface structure which ensures that user is allowed to pass payload in -/// both - array and single element forms. -/// -/// Example: -/// -/// Both versions should work: -/// ```json -/// {..., "payload": {"city": {"type": "keyword", "value": ["Berlin", "London"] }}}, -/// {..., "payload": {"city": {"type": "keyword", "value": "Moscow" }}}, -/// ``` -#[derive(Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Clone)] -#[serde(untagged, rename_all = "snake_case")] -pub enum PayloadVariant { - List(Vec), - Value(T), -} - /// All possible names of payload types #[derive( Debug, Deserialize, Serialize, JsonSchema, Anonymize, Clone, Copy, PartialEq, Hash, Eq, EnumIter, diff --git a/lib/sparse/src/index/inverted_index/inverted_index_ram.rs b/lib/sparse/src/index/inverted_index/inverted_index_ram.rs index d8bba197b4..dd42f39517 100644 --- a/lib/sparse/src/index/inverted_index/inverted_index_ram.rs +++ b/lib/sparse/src/index/inverted_index/inverted_index_ram.rs @@ -211,13 +211,6 @@ impl InvertedIndexRam { self.total_sparse_size += new_vector_size } - - pub fn total_posting_elements_size(&self) -> usize { - self.postings - .iter() - .map(|posting| posting.elements.len() * size_of::()) - .sum() - } } #[cfg(feature = "testing")] diff --git a/lib/storage/src/content_manager/toc/temp_directories.rs b/lib/storage/src/content_manager/toc/temp_directories.rs index 990896c371..6cb4a81ab3 100644 --- a/lib/storage/src/content_manager/toc/temp_directories.rs +++ b/lib/storage/src/content_manager/toc/temp_directories.rs @@ -169,8 +169,4 @@ impl TableOfContent { } Ok(upload_dir) } - - pub fn clear_all_tmp_directories(&self) -> CollectionResult<()> { - clear_tmp_directories(&self.storage_config) - } } diff --git a/lib/trififo/Cargo.toml b/lib/trififo/Cargo.toml index 4ac1cdff37..c06cbc63b8 100644 --- a/lib/trififo/Cargo.toml +++ b/lib/trififo/Cargo.toml @@ -12,9 +12,6 @@ workspace = true [features] bench_all = [] -[dependencies] -ahash = {workspace = true} - [dev-dependencies] itertools = { workspace = true } strum = { workspace = true }