MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / gather_all_vectors_fp32

Method gather_all_vectors_fp32

nodedb-vector/src/collection/codec_build.rs:15–45  ·  view source on GitHub ↗

Collect all live FP32 vectors from every segment (growing, building, and sealed) in insertion order. Used to train the collection-level codec-dispatch index.

(&self)

Source from the content-addressed store, hash-verified

13 /// and sealed) in insertion order. Used to train the collection-level
14 /// codec-dispatch index.
15 pub(crate) fn gather_all_vectors_fp32(&self) -> Vec<Vec<f32>> {
16 let total = self.len();
17 let mut out = Vec::with_capacity(total);
18
19 for i in 0..self.growing.len() as u32 {
20 if let Some(v) = self.growing.get_vector(i) {
21 out.push(v.to_vec());
22 }
23 }
24
25 for seg in &self.building {
26 for i in 0..seg.flat.len() as u32 {
27 if let Some(v) = seg.flat.get_vector(i) {
28 out.push(v.to_vec());
29 }
30 }
31 }
32
33 for seg in &self.sealed {
34 let n = seg.index.len();
35 for i in 0..n as u32 {
36 if !seg.index.is_deleted(i)
37 && let Some(v) = seg.index.get_vector(i)
38 {
39 out.push(v.to_vec());
40 }
41 }
42 }
43
44 out
45 }
46
47 /// Build a codec-dispatched index over all current vectors using the
48 /// requested quantization. Replaces any existing dispatch index for

Callers 1

build_codec_dispatchMethod · 0.80

Calls 5

lenMethod · 0.45
get_vectorMethod · 0.45
pushMethod · 0.45
to_vecMethod · 0.45
is_deletedMethod · 0.45

Tested by

no test coverage detected