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

Method fetch_fp32

nodedb/src/data/vamana_fetcher.rs:245–270  ·  view source on GitHub ↗
(&mut self, idx: u32)

Source from the content-addressed store, hash-verified

243 }
244
245 fn fetch_fp32(&mut self, idx: u32) -> Option<Vec<f32>> {
246 // Drain any completions that arrived since last prefetch/fetch.
247 self.drain_completions();
248
249 // Happy path: pre-fetch already landed.
250 if let Some(v) = self.completed.remove(&idx) {
251 return Some(v);
252 }
253
254 // If still in-flight, wait for it specifically.
255 if self.pending.contains_key(&idx) {
256 // Wait until at least one completion arrives and drain.
257 let _ = self.ring.submit_and_wait(1);
258 self.drain_completions();
259 if let Some(v) = self.completed.remove(&idx) {
260 return Some(v);
261 }
262 }
263
264 // Fallback: index was never pre-fetched (entry-point seed).
265 if idx < self.layout.num_nodes as u32 {
266 return self.read_sync(idx);
267 }
268
269 None
270 }
271}
272
273/// Round `value` up to the next multiple of `align` (must be a power of two).

Callers 2

Calls 3

drain_completionsMethod · 0.80
read_syncMethod · 0.80
removeMethod · 0.45

Tested by 2