(ctx context.Context, rep repo.Repository)
| 419 | } |
| 420 | |
| 421 | func getLocalBackupPaths(ctx context.Context, rep repo.Repository) ([]string, error) { |
| 422 | log(ctx).Debugf("Looking for previous backups of '%v@%v'...", rep.ClientOptions().Hostname, rep.ClientOptions().Username) |
| 423 | |
| 424 | sources, err := snapshot.ListSources(ctx, rep) |
| 425 | if err != nil { |
| 426 | return nil, errors.Wrap(err, "unable to list sources") |
| 427 | } |
| 428 | |
| 429 | var result []string |
| 430 | |
| 431 | for _, src := range sources { |
| 432 | // add all sources belonging to the repository user@host |
| 433 | // ignore sources that have Manual field set to true in the SchedulingPolicy |
| 434 | includeSource, err := shouldSnapshotSource(ctx, src, rep) |
| 435 | if err != nil { |
| 436 | return nil, err |
| 437 | } |
| 438 | |
| 439 | if includeSource { |
| 440 | result = append(result, src.Path) |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | return result, nil |
| 445 | } |
| 446 | |
| 447 | func shouldSnapshotSource(ctx context.Context, src snapshot.SourceInfo, rep repo.Repository) (bool, error) { |
| 448 | policyTree, err := policy.TreeForSource(ctx, rep, src) |
no test coverage detected