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