Return statistics about the content index. Returns `None` if the index does not exist or cannot be opened.
(repo_root: &Path)
| 536 | /// |
| 537 | /// Returns `None` if the index does not exist or cannot be opened. |
| 538 | pub fn content_index_stats(repo_root: &Path) -> Option<ContentIndexStats> { |
| 539 | let config = content_config(repo_root); |
| 540 | let index = Index::open(config).ok()?; |
| 541 | let stats = index.stats(); |
| 542 | Some(ContentIndexStats { |
| 543 | total_documents: stats.total_documents, |
| 544 | total_segments: stats.total_segments, |
| 545 | total_grams: stats.total_grams, |
| 546 | index_size_bytes: stats.index_size_bytes, |
| 547 | overlay_generations: stats.overlay_generations, |
| 548 | pending_edits: stats.pending_edits, |
| 549 | }) |
| 550 | } |
| 551 | |
| 552 | fn content_config(repo_root: &Path) -> Config { |
| 553 | Config { |