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

Method vault_delete

atomic-repository/src/repository/vault.rs:300–324  ·  view source on GitHub ↗

Delete a vault entry by path. Also updates the manifest.

(&self, path: &str)

Source from the content-addressed store, hash-verified

298
299 /// Delete a vault entry by path. Also updates the manifest.
300 pub fn vault_delete(&self, path: &str) -> Result<bool, RepositoryError> {
301 let mut txn = self
302 .pristine
303 .write_txn()
304 .map_err(|e| RepositoryError::Database(e.to_string()))?;
305 use atomic_core::pristine::{VaultMutTxnT, VaultTxnT};
306
307 let existed = txn
308 .del_vault_entry(path)
309 .map_err(|e| RepositoryError::Database(e.to_string()))?;
310
311 if existed {
312 let now = chrono::Utc::now().to_rfc3339();
313 let mut manifest = txn
314 .get_vault_manifest()
315 .map_err(|e| RepositoryError::Database(e.to_string()))?;
316 update_manifest_for_delete(&mut manifest, path, &now);
317 txn.put_vault_manifest(&manifest)
318 .map_err(|e| RepositoryError::Database(e.to_string()))?;
319 }
320
321 txn.commit()
322 .map_err(|e| RepositoryError::Database(e.to_string()))?;
323 Ok(existed)
324 }
325
326 /// Get the vault manifest.
327 pub fn vault_manifest(&self) -> Result<atomic_core::pristine::VaultManifest, RepositoryError> {

Calls 6

write_txnMethod · 0.80
del_vault_entryMethod · 0.80
put_vault_manifestMethod · 0.80
commitMethod · 0.80
get_vault_manifestMethod · 0.45