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

Method get_vector_bytes

nodedb-vector/src/hnsw/graph/index.rs:231–233  ·  view source on GitHub ↗

Dtype-agnostic byte view of the stored vector for node `id`. Returns `None` if `id` is out of range. Pair the returned slice with [`Self::dtype`] to interpret the encoding.

(&self, id: u32)

Source from the content-addressed store, hash-verified

229 /// Returns `None` if `id` is out of range. Pair the returned slice with
230 /// [`Self::dtype`] to interpret the encoding.
231 pub fn get_vector_bytes(&self, id: u32) -> Option<&[u8]> {
232 self.nodes.get(id as usize).map(|n| n.storage.as_bytes())
233 }
234
235 /// Returns a `&[f32]` view of the stored vector for node `id`, consulting
236 /// the pagedb segment backing when the node's local storage is empty.

Callers 1

Calls 2

getMethod · 0.45
as_bytesMethod · 0.45

Tested by 1