diff --git a/cmd/restic/cmd_copy_integration_test.go b/cmd/restic/cmd_copy_integration_test.go index 93f9685f6..252b2fdfe 100644 --- a/cmd/restic/cmd_copy_integration_test.go +++ b/cmd/restic/cmd_copy_integration_test.go @@ -103,7 +103,7 @@ func testPackAndBlobCounts(t testing.TB, gopts global.Options) (countTreePacks i defer unlock() rtest.OK(t, repo.List(context.TODO(), restic.PackFile, func(id restic.ID, size int64) error { - blobs, _, err := repo.ListPack(context.TODO(), id, size) + blobs, err := repo.ListPack(context.TODO(), id, size) rtest.OK(t, err) rtest.Assert(t, len(blobs) > 0, "a packfile should contain at least one blob") diff --git a/cmd/restic/cmd_debug.go b/cmd/restic/cmd_debug.go index 65c25b79e..0a0b43295 100644 --- a/cmd/restic/cmd_debug.go +++ b/cmd/restic/cmd_debug.go @@ -137,7 +137,7 @@ func printPacks(ctx context.Context, repo *repository.Repository, wr io.Writer, var m sync.Mutex return restic.ParallelList(ctx, repo, restic.PackFile, repo.Connections(), func(ctx context.Context, id restic.ID, size int64) error { - blobs, _, err := repo.ListPack(ctx, id, size) + blobs, err := repo.ListPack(ctx, id, size) if err != nil { printer.E("error for pack %v: %v", id.Str(), err) return nil diff --git a/cmd/restic/cmd_find.go b/cmd/restic/cmd_find.go index 6f7a6396a..5254b58a0 100644 --- a/cmd/restic/cmd_find.go +++ b/cmd/restic/cmd_find.go @@ -472,7 +472,7 @@ func (f *Finder) packsToBlobs(ctx context.Context, packs []string) error { delete(packIDs, idStr) } debug.Log("Found pack %s", idStr) - blobs, _, err := f.repo.ListPack(ctx, id, size) + blobs, err := f.repo.ListPack(ctx, id, size) if err != nil { return err } diff --git a/internal/repository/debug.go b/internal/repository/debug.go index 7030ad718..fd6533a82 100644 --- a/internal/repository/debug.go +++ b/internal/repository/debug.go @@ -83,7 +83,7 @@ func ExaminePack(ctx context.Context, repo restic.Repository, id restic.ID, opts printer.S(" ========================================") printer.S(" inspect the pack itself") - blobs, _, err := repo.ListPack(ctx, id, int64(len(buf))) + blobs, err := repo.ListPack(ctx, id, int64(len(buf))) if err != nil { return fmt.Errorf("pack %v: %v", id.Str(), err) } diff --git a/internal/repository/repack_test.go b/internal/repository/repack_test.go index 0c1095301..fc7d86900 100644 --- a/internal/repository/repack_test.go +++ b/internal/repository/repack_test.go @@ -86,7 +86,7 @@ func selectBlobs(t *testing.T, random *rand.Rand, repo restic.Repository, p floa blobs := restic.NewBlobSet() err := repo.List(context.TODO(), restic.PackFile, func(id restic.ID, size int64) error { - entries, _, err := repo.ListPack(context.TODO(), id, size) + entries, err := repo.ListPack(context.TODO(), id, size) if err != nil { t.Fatalf("error listing pack %v: %v", id, err) } diff --git a/internal/repository/repair_pack.go b/internal/repository/repair_pack.go index 39d057976..5059aad04 100644 --- a/internal/repository/repair_pack.go +++ b/internal/repository/repair_pack.go @@ -76,7 +76,7 @@ func resolveBlobsForPacks(ctx context.Context, repo *Repository, ids restic.IDSe err := repo.List(ctx, restic.PackFile, func(id restic.ID, size int64) error { if ids.Has(id) { - blobs, _, err := repo.ListPack(ctx, id, size) + blobs, err := repo.ListPack(ctx, id, size) if err != nil { return nil } diff --git a/internal/repository/repository.go b/internal/repository/repository.go index 86eab8183..7bc61bcc0 100644 --- a/internal/repository/repository.go +++ b/internal/repository/repository.go @@ -781,7 +781,7 @@ func (r *Repository) createIndexFromPacks(ctx context.Context, packsize map[rest // a worker receives an pack ID from ch, reads the pack contents, and adds them to idx worker := func() error { for fi := range ch { - entries, _, err := r.ListPack(wgCtx, fi.ID, fi.Size) + entries, err := r.ListPack(wgCtx, fi.ID, fi.Size) if err != nil { debug.Log("unable to list pack file %v", fi.ID.Str()) m.Lock() @@ -957,12 +957,11 @@ func (r *Repository) List(ctx context.Context, t restic.FileType, fn func(restic }) } -// ListPack returns the list of blobs saved in the pack id and the length of -// the pack header. -func (r *Repository) ListPack(ctx context.Context, id restic.ID, size int64) (restic.Blobs, uint32, error) { +// ListPack returns the list of blobs saved in the pack id. +func (r *Repository) ListPack(ctx context.Context, id restic.ID, size int64) (restic.Blobs, error) { h := backend.Handle{Type: restic.PackFile, Name: id.String()} - entries, hdrSize, err := pack.List(r.Key(), backend.ReaderAt(ctx, r.be, h), size) + entries, _, err := pack.List(r.Key(), backend.ReaderAt(ctx, r.be, h), size) if err != nil { if r.cache != nil { // ignore error as there is not much we can do here @@ -970,9 +969,9 @@ func (r *Repository) ListPack(ctx context.Context, id restic.ID, size int64) (re } // retry on error - entries, hdrSize, err = pack.List(r.Key(), backend.ReaderAt(ctx, r.be, h), size) + entries, _, err = pack.List(r.Key(), backend.ReaderAt(ctx, r.be, h), size) } - return entries, hdrSize, err + return entries, err } // Delete calls backend.Delete() if implemented, and returns an error diff --git a/internal/repository/repository_test.go b/internal/repository/repository_test.go index f2ef1d082..f7bb516a3 100644 --- a/internal/repository/repository_test.go +++ b/internal/repository/repository_test.go @@ -457,7 +457,7 @@ func TestListPack(t *testing.T) { return nil })) - blobs, _, err := repo.ListPack(context.TODO(), packID, size) + blobs, err := repo.ListPack(context.TODO(), packID, size) rtest.OK(t, err) rtest.Assert(t, len(blobs) == 1 && blobs[0].ID == id, "unexpected blobs in pack: %v", blobs) diff --git a/internal/restic/repository.go b/internal/restic/repository.go index 1476c2468..f8b5cef33 100644 --- a/internal/restic/repository.go +++ b/internal/restic/repository.go @@ -32,9 +32,8 @@ type Repository interface { // the index iteration returns immediately with ctx.Err(). This blocks any modification of the index. ListBlobs(ctx context.Context, fn func(PackedBlob)) error ListPacksFromIndex(ctx context.Context, packs IDSet) <-chan PackBlobs - // ListPack returns the list of blobs saved in the pack id and the length of - // the pack header. - ListPack(ctx context.Context, id ID, packSize int64) (entries Blobs, hdrSize uint32, err error) + // ListPack returns the list of blobs saved in the pack id. + ListPack(ctx context.Context, id ID, packSize int64) (entries Blobs, err error) LoadBlob(ctx context.Context, t BlobType, id ID, buf []byte) ([]byte, error) LoadBlobsFromPack(ctx context.Context, packID ID, blobs Blobs, handleBlobFn func(blob BlobHandle, buf []byte, err error) error) error