MCPcopy Index your code
hub / github.com/kopia/kopia / getLocalBackupPaths

Function getLocalBackupPaths

cli/command_snapshot_create.go:421–445  ·  view source on GitHub ↗
(ctx context.Context, rep repo.Repository)

Source from the content-addressed store, hash-verified

419}
420
421func 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
447func shouldSnapshotSource(ctx context.Context, src snapshot.SourceInfo, rep repo.Repository) (bool, error) {
448 policyTree, err := policy.TreeForSource(ctx, rep, src)

Callers 1

runMethod · 0.85

Calls 3

ListSourcesFunction · 0.92
shouldSnapshotSourceFunction · 0.85
ClientOptionsMethod · 0.65

Tested by

no test coverage detected