Delete a vault entry by path. Also updates the manifest.
(&self, path: &str)
| 285 | |
| 286 | /// Delete a vault entry by path. Also updates the manifest. |
| 287 | pub fn vault_delete(&self, path: &str) -> Result<bool, RepositoryError> { |
| 288 | let mut txn = self |
| 289 | .pristine |
| 290 | .write_txn() |
| 291 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 292 | use atomic_core::pristine::{VaultMutTxnT, VaultTxnT}; |
| 293 | |
| 294 | let existed = txn |
| 295 | .del_vault_entry(path) |
| 296 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 297 | |
| 298 | if existed { |
| 299 | let now = chrono::Utc::now().to_rfc3339(); |
| 300 | let mut manifest = txn |
| 301 | .get_vault_manifest() |
| 302 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 303 | update_manifest_for_delete(&mut manifest, path, &now); |
| 304 | txn.put_vault_manifest(&manifest) |
| 305 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 306 | } |
| 307 | |
| 308 | txn.commit() |
| 309 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 310 | Ok(existed) |
| 311 | } |
| 312 | |
| 313 | /// Get the vault manifest. |
| 314 | pub fn vault_manifest(&self) -> Result<atomic_core::pristine::VaultManifest, RepositoryError> { |