migrate: Allow migrations to request a check run

This is currently only used by upgrade_repo_v2.
This commit is contained in:
Michael Eischer 2022-05-01 20:16:49 +02:00
parent 59eb132dcd
commit c1bbbcd0dc
4 changed files with 26 additions and 0 deletions

View file

@ -6,11 +6,16 @@ import (
"github.com/restic/restic/internal/restic"
)
type RepositoryCheckOptions struct {
}
// Migration implements a data migration.
type Migration interface {
// Check returns true if the migration can be applied to a repo.
Check(context.Context, restic.Repository) (bool, error)
RepoCheckOptions() *RepositoryCheckOptions
// Apply runs the migration.
Apply(context.Context, restic.Repository) error