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

Method vault_materialize

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

Materialize a single vault entry to disk. Reads the entry from redb and writes it as a markdown file with YAML frontmatter to `.vault/ `. # Errors Returns an error if: - The entry doesn't exist in redb - The file can't be written (permissions, disk full, etc.)

(&self, path: &str)

Source from the content-addressed store, hash-verified

501 /// - The entry doesn't exist in redb
502 /// - The file can't be written (permissions, disk full, etc.)
503 pub fn vault_materialize(&self, path: &str) -> Result<(), RepositoryError> {
504 let entry = self
505 .vault_retrieve(path)?
506 .ok_or_else(|| RepositoryError::FileNotFound {
507 path: PathBuf::from(path),
508 })?;
509
510 let disk_path = self.vault_dir().join(path);
511
512 // Ensure parent directories exist
513 if let Some(parent) = disk_path.parent() {
514 std::fs::create_dir_all(parent)?;
515 }
516
517 let markdown = render_entry_to_markdown(&entry);
518 std::fs::write(&disk_path, markdown)?;
519
520 Ok(())
521 }
522
523 /// Materialize all vault entries to disk.
524 ///

Callers 15

runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
signed_fixtureFunction · 0.80
vault_goal_startMethod · 0.80
vault_goal_stopMethod · 0.80
vault_goal_resumeMethod · 0.80

Calls 5

render_entry_to_markdownFunction · 0.85
vault_retrieveMethod · 0.80
vault_dirMethod · 0.80
parentMethod · 0.80
writeFunction · 0.50