Skip to content

Commit

Permalink
Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketkedia committed Nov 11, 2024
1 parent 5d37fc3 commit 15357ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 10 additions & 4 deletions rust/index/src/spann/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
};

// TODO(Sanket): Add locking structures as necessary.
struct VersionsMapInner {
pub struct VersionsMapInner {
versions_map: HashMap<u32, u32>,
}

Expand Down Expand Up @@ -82,8 +82,11 @@ impl ChromaError for SpannIndexWriterConstructionError {
const MAX_HEAD_OFFSET_ID: &str = "max_head_offset_id";

// TODO(Sanket): Make this configurable.
#[allow(dead_code)]
const NUM_CENTROIDS_TO_SEARCH: u32 = 64;
#[allow(dead_code)]
const RNG_FACTOR: f32 = 1.0;
#[allow(dead_code)]
const SPLIT_THRESHOLD: usize = 100;

impl SpannIndexWriter {
Expand Down Expand Up @@ -281,6 +284,7 @@ impl SpannIndexWriter {
*write_lock.versions_map.get(&id).unwrap()
}

#[allow(dead_code)]
async fn rng_query(
&self,
query: &[f32],
Expand Down Expand Up @@ -341,6 +345,7 @@ impl SpannIndexWriter {
Ok((res_ids, res_distances))
}

#[allow(dead_code)]
async fn append(
&self,
head_id: u32,
Expand Down Expand Up @@ -403,13 +408,14 @@ impl SpannIndexWriter {
Ok(())
}

#[allow(dead_code)]
async fn add_postings_list(
&self,
id: u32,
version: u32,
embeddings: &[f32],
) -> Result<(), SpannIndexWriterConstructionError> {
let (ids, distances) = self.rng_query(embeddings).await?;
let (ids, _) = self.rng_query(embeddings).await?;
// Create a centroid with just this point.
if ids.is_empty() {
let next_id = self
Expand Down Expand Up @@ -450,7 +456,7 @@ impl SpannIndexWriter {
Ok(())
}

pub async fn add(&self, id: u32, embeddings: &[f32]) {
let version = self.add_versions_map(id);
pub async fn add(&self, id: u32, _: &[f32]) {
let _ = self.add_versions_map(id);
}
}
3 changes: 1 addition & 2 deletions rust/worker/src/segment/spann_segment.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::collections::HashMap;

use arrow::{compute::max, error};
use chroma_blockstore::provider::BlockfileProvider;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_index::IndexUuid;
Expand Down Expand Up @@ -197,7 +196,7 @@ impl<'a> SegmentWriter<'a> for SpannSegmentWriter {
&self,
records: chroma_types::Chunk<super::MaterializedLogRecord<'a>>,
) -> Result<(), ApplyMaterializedLogError> {
for (record, idx) in records.iter() {
for (record, _) in records.iter() {
match record.final_operation {
MaterializedLogOperation::AddNew => {
self.add(record).await;
Expand Down

0 comments on commit 15357ab

Please sign in to comment.