Add ETA estimation to cluster backup/restore operations

- Created internal/progress/estimator.go with ETAEstimator component
- Tracks elapsed time and estimates remaining time based on progress
- Enhanced Spinner and LineByLine indicators to display ETA info
- Integrated into BackupCluster and RestoreCluster functions
- Display format: 'Operation | X/Y (Z%) | Elapsed: Xm | ETA: ~Ym remaining'
- Preserves spinner animation while showing progress/time estimates
- Quick Win approach: no historical data storage, just current operation tracking
This commit is contained in:
2025-11-07 13:28:11 +00:00
parent ebb77fb960
commit b3ac5a18df
17 changed files with 233 additions and 24 deletions

View File

@ -333,12 +333,19 @@ func (e *Engine) BackupCluster(ctx context.Context) error {
return fmt.Errorf("failed to list databases: %w", err)
}
// Create ETA estimator for database backups
estimator := progress.NewETAEstimator("Backing up cluster", len(databases))
quietProgress.SetEstimator(estimator)
// Backup each database
e.printf(" Backing up %d databases...\n", len(databases))
successCount := 0
failCount := 0
for i, dbName := range databases {
// Update estimator progress
estimator.UpdateProgress(i)
e.printf(" [%d/%d] Backing up database: %s\n", i+1, len(databases), dbName)
quietProgress.Update(fmt.Sprintf("Backing up database %d/%d: %s", i+1, len(databases), dbName))