Skip to content

Commit 380af69

Browse files
committed
more refactoring and removing todos
1 parent 10cb87a commit 380af69

File tree

8 files changed

+4
-68
lines changed

8 files changed

+4
-68
lines changed

helix-db/src/helix_engine/macros.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ pub mod macros {
178178
#[macro_export]
179179
macro_rules! traversal_remapping {
180180
($remapping_vals:expr, $var_name:expr, $should_spread:expr, $new_name:expr => $traversal:expr) => {{
181-
// TODO: ref?
182-
// Apply remappings to the nested traversal result
183-
184181
let nested_return_value = ReturnValue::from_traversal_value_array_with_mixin(
185182
$traversal,
186183
$remapping_vals.borrow_mut(),

helix-db/src/helix_engine/traversal_core/ops/source/n_from_index.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ impl<'a, I: Iterator<Item = Result<TraversalValue, GraphError>>, K: Into<Value>
8181
.storage
8282
.secondary_indices
8383
.get(index)
84-
// TODO: this
8584
.ok_or(GraphError::New(format!(
8685
"Secondary Index {index} not found"
8786
)))

helix-db/src/helix_engine/traversal_core/ops/vectors/insert.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::{
88
},
99
protocol::value::Value,
1010
};
11-
use std::sync::Arc;
1211

1312
pub struct InsertVIterator {
1413
inner: std::iter::Once<Result<TraversalValue, GraphError>>,
@@ -31,14 +30,6 @@ pub trait InsertVAdapter<'a, 'b>: Iterator<Item = Result<TraversalValue, GraphEr
3130
) -> RwTraversalIterator<'a, 'b, impl Iterator<Item = Result<TraversalValue, GraphError>>>
3231
where
3332
F: Fn(&HVector, &RoTxn) -> bool;
34-
35-
fn insert_vs<F>(
36-
self,
37-
queries: &[Vec<f64>],
38-
fields: Option<Vec<(String, Value)>>,
39-
) -> RwTraversalIterator<'a, 'b, impl Iterator<Item = Result<TraversalValue, GraphError>>>
40-
where
41-
F: Fn(&HVector, &RoTxn) -> bool;
4233
}
4334

4435
impl<'a, 'b, I: Iterator<Item = Result<TraversalValue, GraphError>>> InsertVAdapter<'a, 'b>
@@ -77,32 +68,4 @@ impl<'a, 'b, I: Iterator<Item = Result<TraversalValue, GraphError>>> InsertVAdap
7768
txn: self.txn,
7869
}
7970
}
80-
81-
fn insert_vs<F>(
82-
self,
83-
queries: &[Vec<f64>],
84-
fields: Option<Vec<(String, Value)>>,
85-
) -> RwTraversalIterator<'a, 'b, impl Iterator<Item = Result<TraversalValue, GraphError>>>
86-
where
87-
F: Fn(&HVector, &RoTxn) -> bool,
88-
{
89-
let txn = self.txn;
90-
let storage = Arc::clone(&self.storage);
91-
let iter = queries
92-
.iter()
93-
.map(|vec| {
94-
let vector = storage.vectors.insert::<F>(txn, vec, fields.clone()); // TODO: remove clone
95-
match vector {
96-
Ok(vector) => Ok(TraversalValue::Vector(vector)),
97-
Err(e) => Err(GraphError::from(e)),
98-
}
99-
})
100-
.collect::<Vec<_>>();
101-
102-
RwTraversalIterator {
103-
inner: iter.into_iter(),
104-
storage: self.storage,
105-
txn,
106-
}
107-
}
10871
}

helix-db/src/helix_engine/vector_core/vector_core.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ impl VectorCore {
106106

107107
#[inline]
108108
fn get_new_level(&self) -> usize {
109-
// TODO: look at using the XOR shift algorithm for random number generation
110-
// Should instead using an atomic mutable seed and the XOR shift algorithm
111109
let mut rng = rand::rng();
112110
let r: f64 = rng.random::<f64>();
113111
(-r.ln() * self.config.m_l).floor() as usize
@@ -175,7 +173,6 @@ impl VectorCore {
175173
for result in iter {
176174
let (key, _) = result?;
177175

178-
// TODO: fix here because not working at all
179176
let mut arr = [0u8; 16];
180177
let len = std::cmp::min(key.len(), 16);
181178
arr[..len].copy_from_slice(&key[prefix_len..(prefix_len + len)]);
@@ -188,20 +185,13 @@ impl VectorCore {
188185
let vector = self.get_vector(txn, neighbor_id, level, false)?;
189186

190187
let passes_filters = match filter {
191-
// TODO: look at implementing a macro that actually just runs each function rather than iterating through
192188
Some(filter_slice) => filter_slice.iter().all(|f| f(&vector, txn)),
193189
None => true,
194190
};
195191

196192
if passes_filters {
197193
neighbors.push(vector);
198194
}
199-
200-
//if let Ok(vector) = self.get_vector(txn, neighbor_id, level, true) {
201-
// if filter.is_none() || filter.unwrap().iter().all(|f| f(&vector, txn)) {
202-
// neighbors.push(vector);
203-
// }
204-
//}
205195
}
206196
neighbors.shrink_to_fit();
207197

helix-db/src/helix_gateway/embedding_providers/embedding_providers.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ use sonic_rs::{JsonContainerTrait, json};
55
use std::env;
66
use url::Url;
77

8-
// TODO: add support for rust native embedding model libs as well so it runs fully built in
9-
// in case we have a gpu or something on the server we're running it on
10-
118
/// Trait for embedding models to fetch text embeddings.
129
#[allow(async_fn_in_trait)]
1310
pub trait EmbeddingModel {

helix-db/src/helix_gateway/worker_pool/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ impl WorkerPool {
3333
"Expected number of threads in thread pool to be more than 0, got {size}"
3434
);
3535

36-
let (req_tx, req_rx) = flume::bounded::<ReqMsg>(1000); // TODO: make this configurable
37-
let (cont_tx, cont_rx) = flume::bounded::<ContMsg>(1000); // TODO: make this configurable
36+
let (req_tx, req_rx) = flume::bounded::<ReqMsg>(1000);
37+
let (cont_tx, cont_rx) = flume::bounded::<ContMsg>(1000);
3838

3939
let workers = (0..size)
4040
.map(|_| {

helix-db/src/helixc/analyzer/methods/infer_expr_type.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ pub(crate) fn infer_expr_type<'a>(
558558
from,
559559
label,
560560
properties,
561-
// secondary_indices: None, // TODO: Add secondary indices by checking against labeled `INDEX` fields in schema
562561
};
563562
let stmt = GeneratedStatement::Traversal(GeneratedTraversal {
564563
source_step: Separator::Period(SourceStep::AddE(add_e)),

helix-db/src/helixc/analyzer/methods/traversal_validation.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ pub(crate) fn validate_traversal<'a>(
287287
// anonymous will be the traversal type rather than the start type
288288
StartNode::Anonymous => {
289289
let parent = parent_ty.unwrap();
290-
gen_traversal.traversal_type = TraversalType::FromVar(GenRef::Std(DEFAULT_VAR_NAME.to_string()));
290+
gen_traversal.traversal_type =
291+
TraversalType::FromVar(GenRef::Std(DEFAULT_VAR_NAME.to_string()));
291292
gen_traversal.source_step = Separator::Empty(SourceStep::Anonymous);
292293
parent
293294
}
@@ -531,16 +532,6 @@ pub(crate) fn validate_traversal<'a>(
531532
}
532533

533534
StepType::Object(obj) => {
534-
// TODO: Fix issue with step count being incorrect (i think its counting each field as a step)
535-
// if i != number_of_steps {
536-
// println!("{} {}", i, number_of_steps);
537-
// push_query_err(ctx,
538-
// original_query,
539-
// obj.loc.clone(),
540-
// "object is only valid as the last step in a traversal".to_string(),
541-
// "move the object to the end of the traversal",
542-
// );
543-
// }
544535
validate_object(
545536
ctx,
546537
&cur_ty,

0 commit comments

Comments
 (0)