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

Method vault_record_working_copy

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

Deflate changed vault files from disk into redb. Scans the vault working copy, detects changes, and updates the database. Returns the list of paths that were updated. This is the inverse of `vault_materialize_all`. Together they form the inflate/deflate cycle: - `vault_materialize_all`: redb -> disk (for humans to read/edit) - `vault_record_working_copy`: disk -> redb (after humans edit)

(&self)

Source from the content-addressed store, hash-verified

648 /// - `vault_materialize_all`: redb -> disk (for humans to read/edit)
649 /// - `vault_record_working_copy`: disk -> redb (after humans edit)
650 pub fn vault_record_working_copy(&self) -> Result<Vec<String>, RepositoryError> {
651 let changes = self.vault_scan_working_copy()?;
652
653 if changes.is_empty() {
654 return Ok(Vec::new());
655 }
656
657 let mut updated_paths = Vec::new();
658
659 for change in &changes {
660 match change.change_type {
661 VaultChangeType::New | VaultChangeType::Modified => {
662 // Infer entry type from path
663 let entry_type = infer_entry_type(&change.path);
664
665 self.vault_store(
666 &change.path,
667 entry_type,
668 change.content.clone(),
669 change.frontmatter_json.clone(),
670 )?;
671
672 updated_paths.push(change.path.clone());
673 }
674 VaultChangeType::Deleted => {
675 self.vault_delete(&change.path)?;
676 updated_paths.push(change.path.clone());
677 }
678 }
679 }
680
681 Ok(updated_paths)
682 }
683}
684
685// ── Manifest helpers ────────────────────────────────────────────────────

Calls 7

infer_entry_typeFunction · 0.85
vault_storeMethod · 0.80
vault_deleteMethod · 0.80
is_emptyMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45