MCPcopy Create free account
hub / github.com/cortexkit/magic-context / delete_memory

Function delete_memory

packages/dashboard/src-tauri/src/db.rs:3477–3500  ·  view source on GitHub ↗
(conn: &mut Connection, memory_id: i64)

Source from the content-addressed store, hash-verified

3475}
3476
3477pub fn delete_memory(conn: &mut Connection, memory_id: i64) -> Result<(), rusqlite::Error> {
3478 // Phase A: resolve the target row before opening a write transaction.
3479 let target = lookup_memory_mutation_target(conn, memory_id)?;
3480
3481 // Phase B: re-check, queue before delete, then delete.
3482 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate)?;
3483 verify_memory_project_path_unchanged(&tx, memory_id, &target.project_path)?;
3484 queue_memory_mutation(
3485 &tx,
3486 &target.project_path,
3487 "delete",
3488 memory_id,
3489 None,
3490 target.category.as_deref(),
3491 None,
3492 )?;
3493 tx.execute(
3494 "DELETE FROM memory_embeddings WHERE memory_id = ?1",
3495 params![memory_id],
3496 )?;
3497 tx.execute("DELETE FROM memories WHERE id = ?1", params![memory_id])?;
3498 tx.commit()?;
3499 Ok(())
3500}
3501
3502/// Bulk-update status for a set of memory IDs in one transaction.
3503///

Callers 1

dispatchFunction · 0.50

Calls 4

queue_memory_mutationFunction · 0.85
commitMethod · 0.80

Tested by

no test coverage detected