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

Method vault_record_working_copy

atomic-repository/src/repository/vault.rs:542–574  ·  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

540 /// - `vault_materialize_all`: redb -> disk (for humans to read/edit)
541 /// - `vault_record_working_copy`: disk -> redb (after humans edit)
542 pub fn vault_record_working_copy(&self) -> Result<Vec<String>, RepositoryError> {
543 let changes = self.vault_scan_working_copy()?;
544
545 if changes.is_empty() {
546 return Ok(Vec::new());
547 }
548
549 let mut updated_paths = Vec::new();
550
551 for change in &changes {
552 match change.change_type {
553 VaultChangeType::New | VaultChangeType::Modified => {
554 // Infer entry type from path
555 let entry_type = infer_entry_type(&change.path);
556
557 self.vault_store(
558 &change.path,
559 entry_type,
560 change.content.clone(),
561 change.frontmatter_json.clone(),
562 )?;
563
564 updated_paths.push(change.path.clone());
565 }
566 VaultChangeType::Deleted => {
567 self.vault_delete(&change.path)?;
568 updated_paths.push(change.path.clone());
569 }
570 }
571 }
572
573 Ok(updated_paths)
574 }
575}
576
577// ── Manifest helpers ────────────────────────────────────────────────────

Callers 7

runMethod · 0.80
recordMethod · 0.80

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