MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / put_embedding

Method put_embedding

atomic-core/src/pristine/txn/write/embeddings.rs:171–185  ·  view source on GitHub ↗
(
        &mut self,
        path: &str,
        chunk_idx: u32,
        record: &EmbeddingRecord,
    )

Source from the content-addressed store, hash-verified

169
170impl<'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

Callers 10

test_embedding_crudFunction · 0.80
test_embedding_deleteFunction · 0.80
test_embedding_searchFunction · 0.80
test_embedding_overwriteFunction · 0.80
vault_embedMethod · 0.80

Calls 4

encode_embedding_keyFunction · 0.85
insertMethod · 0.45
as_strMethod · 0.45
as_sliceMethod · 0.45