MCPcopy Create free account
hub / github.com/carsonpo/haystackdb / insert

Method insert

src/structures/dense_vector_list.rs:181–192  ·  view source on GitHub ↗
(&mut self, index: usize, vector: [u8; QUANTIZED_VECTOR_SIZE])

Source from the content-addressed store, hash-verified

179 }
180
181 pub fn insert(&mut self, index: usize, vector: [u8; QUANTIZED_VECTOR_SIZE]) -> io::Result<()> {
182 let offset = HEADER_SIZE + index * QUANTIZED_VECTOR_SIZE;
183 let end = offset + QUANTIZED_VECTOR_SIZE;
184
185 if end > self.used_space + HEADER_SIZE {
186 self.resize_mmap(end * 2)?;
187 }
188
189 self.mmap[offset..end].copy_from_slice(&vector);
190
191 Ok(())
192 }
193}

Callers

nothing calls this directly

Calls 1

resize_mmapMethod · 0.45

Tested by

no test coverage detected