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

Method vault_materialize_all

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

Materialize all vault entries to disk. Reads every entry from redb and writes it as a markdown file. Also writes the manifest as `_manifest.json`. This is useful after `atomic pull` or for rebuilding the vault directory from scratch.

(&self)

Source from the content-addressed store, hash-verified

493 /// This is useful after `atomic pull` or for rebuilding the vault
494 /// directory from scratch.
495 pub fn vault_materialize_all(&self) -> Result<usize, RepositoryError> {
496 let entries = self.vault_list("", None)?;
497 let mut count = 0;
498
499 for meta in &entries {
500 self.vault_materialize(&meta.path)?;
501 count += 1;
502 }
503
504 // Also write the manifest file
505 let manifest = self.vault_manifest()?;
506 let manifest_path = self.vault_dir().join("_manifest.json");
507 let manifest_json = serde_json::to_string_pretty(&manifest)
508 .map_err(|e| RepositoryError::Serialization(e.to_string()))?;
509 std::fs::write(&manifest_path, manifest_json)?;
510
511 Ok(count)
512 }
513
514 /// Recompute the vault manifest's file_count and total_bytes from scratch.
515 ///

Callers 3

runMethod · 0.80
run_asyncMethod · 0.80

Calls 5

writeFunction · 0.85
vault_listMethod · 0.80
vault_materializeMethod · 0.80
vault_manifestMethod · 0.80
vault_dirMethod · 0.80

Tested by 1