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

Method vault_record_working_copy

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

527 /// - `vault_materialize_all`: redb -> disk (for humans to read/edit)
528 /// - `vault_record_working_copy`: disk -> redb (after humans edit)
529 pub fn vault_record_working_copy(&self) -> Result<Vec<String>, RepositoryError> {
530 let changes = self.vault_scan_working_copy()?;
531
532 if changes.is_empty() {
533 return Ok(Vec::new());
534 }
535
536 let mut updated_paths = Vec::new();
537
538 for change in &changes {
539 match change.change_type {
540 VaultChangeType::New | VaultChangeType::Modified => {
541 // Infer entry type from path
542 let entry_type = infer_entry_type(&change.path);
543
544 self.vault_store(
545 &change.path,
546 entry_type,
547 change.content.clone(),
548 change.frontmatter_json.clone(),
549 )?;
550
551 updated_paths.push(change.path.clone());
552 }
553 VaultChangeType::Deleted => {
554 self.vault_delete(&change.path)?;
555 updated_paths.push(change.path.clone());
556 }
557 }
558 }
559
560 Ok(updated_paths)
561 }
562}
563
564// ── 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