Regenerate SEMANTIC sections for all changes that need it. Scans the redb store for changes that have GRAPH sections but no SEMANTIC sections, and regenerates them. If `options.force` is true, regenerates all changes regardless. # Arguments `store` - The redb change store. `change_hashes` - List of change hashes to consider. `options` - Regeneration options. # Returns Batch statistics. # Exa
(
store: &RedbChangeStore,
change_hashes: &[[u8; 32]],
options: &RegenOptions,
)
| 748 | /// println!("{}", stats); |
| 749 | /// ``` |
| 750 | pub fn regenerate_batch( |
| 751 | store: &RedbChangeStore, |
| 752 | change_hashes: &[[u8; 32]], |
| 753 | options: &RegenOptions, |
| 754 | ) -> RegenResult<BatchRegenStats> { |
| 755 | let start = Instant::now(); |
| 756 | let mut batch_stats = BatchRegenStats::default(); |
| 757 | |
| 758 | for hash in change_hashes { |
| 759 | batch_stats.changes_processed += 1; |
| 760 | |
| 761 | match regenerate_change(store, hash, options) { |
| 762 | Ok(stats) => { |
| 763 | if stats.files_regenerated > 0 { |
| 764 | batch_stats.changes_regenerated += 1; |
| 765 | batch_stats.total_files += stats.files_regenerated; |
| 766 | batch_stats.total_lines += stats.lines_generated; |
| 767 | batch_stats.total_tokens += stats.tokens_generated; |
| 768 | } else { |
| 769 | batch_stats.changes_skipped += 1; |
| 770 | } |
| 771 | } |
| 772 | Err(e) => { |
| 773 | log::warn!("Failed to regenerate change: {}", e); |
| 774 | batch_stats.changes_errored += 1; |
| 775 | } |
| 776 | } |
| 777 | } |
| 778 | |
| 779 | batch_stats.elapsed_ms = start.elapsed().as_millis() as u64; |
| 780 | Ok(batch_stats) |
| 781 | } |
| 782 | |
| 783 | // ═══════════════════════════════════════════════════════════════════════ |
| 784 | // Tests |