feat: implement full restore functionality with TUI integration

- Add complete restore engine (internal/restore/)
  - RestoreSingle() for single database restore
  - RestoreCluster() for full cluster restore
  - Archive format detection (7 formats supported)
  - Safety validation (integrity, disk space, tools)
  - Streaming decompression with pigz support

- Add CLI restore commands (cmd/restore.go)
  - restore single: restore single database backup
  - restore cluster: restore full cluster backup
  - restore list: list available backup archives
  - Safety-first design: dry-run by default, --confirm required

- Add TUI restore integration (internal/tui/)
  - Archive browser: browse and select backups
  - Restore preview: safety checks and confirmation
  - Restore execution: real-time progress tracking
  - Backup manager: comprehensive archive management

- Features:
  - Format auto-detection (.dump, .dump.gz, .sql, .sql.gz, .tar.gz)
  - Archive validation before restore
  - Disk space verification
  - Tool availability checks
  - Target database configuration
  - Clean-first and create-if-missing options
  - Parallel decompression support
  - Progress tracking with phases

Phase 1 (Core Functionality) complete and tested
This commit is contained in:
2025-11-07 09:41:44 +00:00
parent 33d53612d2
commit 87e0ca3b39
12 changed files with 3222 additions and 19 deletions

View File

@ -18,19 +18,6 @@ import (
// Create placeholder commands for the other subcommands
var restoreCmd = &cobra.Command{
Use: "restore [archive]",
Short: "Restore from backup archive",
Long: `Restore database from backup archive. Auto-detects archive format.`,
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("backup archive filename required")
}
return runRestore(cmd.Context(), args[0])
},
}
var verifyCmd = &cobra.Command{
Use: "verify [archive]",
Short: "Verify backup archive integrity",