MCPcopy Create free account
hub / github.com/cosdata/cosdata / delete

Method delete

src/models/collection.rs:360–373  ·  view source on GitHub ↗
(&self, env: &Environment, db: Database)

Source from the content-addressed store, hash-verified

358 /// deletes a collection instance from the disk (lmdb -> collections database)
359 #[allow(dead_code)]
360 pub fn delete(&self, env: &Environment, db: Database) -> Result<(), WaCustomError> {
361 let key = self.get_key();
362
363 let mut txn = env
364 .begin_rw_txn()
365 .map_err(|e| WaCustomError::DatabaseError(e.to_string()))?;
366
367 txn.del(db, &key, None)
368 .map_err(|e| WaCustomError::DatabaseError(e.to_string()))?;
369 txn.commit()
370 .map_err(|e| WaCustomError::DatabaseError(e.to_string()))?;
371
372 Ok(())
373 }
374
375 pub fn get_hnsw_index(&self) -> Option<Arc<HNSWIndex>> {
376 self.hnsw_index.read().clone()

Callers 1

delete_embeddingMethod · 0.45

Calls 1

get_keyMethod · 0.80

Tested by

no test coverage detected