From ccc84af73d98728fa6f767a3ab018781faab54cd Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 7 Nov 2020 18:19:25 +0100 Subject: [PATCH] debug/list: parallelize index loading --- cmd/restic/cmd_debug.go | 4 +--- cmd/restic/cmd_list.go | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cmd/restic/cmd_debug.go b/cmd/restic/cmd_debug.go index 0eb1c8e87..3403b259a 100644 --- a/cmd/restic/cmd_debug.go +++ b/cmd/restic/cmd_debug.go @@ -110,10 +110,8 @@ func printPacks(ctx context.Context, repo *repository.Repository, wr io.Writer) } func dumpIndexes(ctx context.Context, repo restic.Repository, wr io.Writer) error { - return repo.List(ctx, restic.IndexFile, func(id restic.ID, size int64) error { + return repository.ForAllIndexes(ctx, repo, func(id restic.ID, idx *repository.Index, oldFormat bool, err error) error { Printf("index_id: %v\n", id) - - idx, err := repository.LoadIndex(ctx, repo, id) if err != nil { return err } diff --git a/cmd/restic/cmd_list.go b/cmd/restic/cmd_list.go index 50b55e857..af711da3d 100644 --- a/cmd/restic/cmd_list.go +++ b/cmd/restic/cmd_list.go @@ -60,8 +60,7 @@ func runList(cmd *cobra.Command, opts GlobalOptions, args []string) error { case "locks": t = restic.LockFile case "blobs": - return repo.List(opts.ctx, restic.IndexFile, func(id restic.ID, size int64) error { - idx, err := repository.LoadIndex(opts.ctx, repo, id) + return repository.ForAllIndexes(opts.ctx, repo, func(id restic.ID, idx *repository.Index, oldFormat bool, err error) error { if err != nil { return err } @@ -70,7 +69,6 @@ func runList(cmd *cobra.Command, opts GlobalOptions, args []string) error { } return nil }) - default: return errors.Fatal("invalid type") }