| 169 | |
| 170 | impl<'a> EmbeddingsMutTxnT for WriteTxn<'a> { |
| 171 | fn put_embedding( |
| 172 | &mut self, |
| 173 | path: &str, |
| 174 | chunk_idx: u32, |
| 175 | record: &EmbeddingRecord, |
| 176 | ) -> PristineResult<()> { |
| 177 | let bytes = postcard::to_allocvec(record).map_err(|e| PristineError::Serialization { |
| 178 | message: format!("failed to serialize EmbeddingRecord for '{}': {}", path, e), |
| 179 | })?; |
| 180 | |
| 181 | let key = encode_embedding_key(path, chunk_idx); |
| 182 | let mut table = self.txn.open_table(EMBEDDINGS)?; |
| 183 | table.insert(key.as_str(), bytes.as_slice())?; |
| 184 | Ok(()) |
| 185 | } |
| 186 | |
| 187 | fn del_embeddings(&mut self, path: &str) -> PristineResult<usize> { |
| 188 | // First collect all keys for this path |