MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / delete_memory

Method delete_memory

core/src/memory/store.rs:179–190  ·  view source on GitHub ↗

Delete a single memory by ID.

(&self, memory_id: &MemoryId)

Source from the content-addressed store, hash-verified

177
178 /// Delete a single memory by ID.
179 pub async fn delete_memory(&self, memory_id: &MemoryId) -> GraphBitResult<()> {
180 let id = memory_id.to_string();
181 let conn_arc = Arc::clone(&self.conn);
182
183 tokio::task::spawn_blocking(move || -> GraphBitResult<()> {
184 let conn = conn_arc.blocking_lock();
185 conn.execute("DELETE FROM memories WHERE id = ?1", rusqlite::params![id])?;
186 Ok(())
187 })
188 .await
189 .map_err(|e| GraphBitError::memory(format!("Join error: {e}")))?
190 }
191
192 /// Delete all memories matching the given scope.
193 pub async fn delete_all_memories(&self, scope: &MemoryScope) -> GraphBitResult<()> {

Callers 2

test_metadata_store_crudFunction · 0.80

Calls 2

to_stringMethod · 0.80
executeMethod · 0.45

Tested by 1

test_metadata_store_crudFunction · 0.64