mirror of
https://github.com/kopia/kopia.git
synced 2026-01-22 21:38:06 -05:00
instead moved to run as part of maintenance ('kopia maintenance run')
added 'kopia maintenance run --force' flag which runs maintenance even
if not owned
29 lines
826 B
Go
29 lines
826 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/kopia/kopia/repo"
|
|
"github.com/kopia/kopia/repo/maintenance"
|
|
"github.com/kopia/kopia/snapshot/snapshotmaintenance"
|
|
)
|
|
|
|
var (
|
|
maintenanceRunCommand = maintenanceCommands.Command("run", "Run repository maintenance").Default()
|
|
maintenanceRunFull = maintenanceRunCommand.Flag("full", "Full maintenance").Bool()
|
|
maintenanceRunForce = maintenanceRunCommand.Flag("force", "Run maintenance even if not owned (unsafe)").Hidden().Bool()
|
|
)
|
|
|
|
func runMaintenanceCommand(ctx context.Context, rep *repo.DirectRepository) error {
|
|
mode := maintenance.ModeQuick
|
|
if *maintenanceRunFull {
|
|
mode = maintenance.ModeFull
|
|
}
|
|
|
|
return snapshotmaintenance.Run(ctx, rep, mode, *maintenanceRunForce)
|
|
}
|
|
|
|
func init() {
|
|
maintenanceRunCommand.Action(directRepositoryAction(runMaintenanceCommand))
|
|
}
|