mirror of
https://github.com/octoleo/restic.git
synced 2024-12-23 03:18:55 +00:00
debug: use repository.ListPack wrapper
This commit is contained in:
parent
a61fbd287a
commit
9197c63007
@ -105,9 +105,7 @@ type Blob struct {
|
|||||||
func printPacks(ctx context.Context, repo *repository.Repository, wr io.Writer) error {
|
func printPacks(ctx context.Context, repo *repository.Repository, wr io.Writer) error {
|
||||||
|
|
||||||
return repo.List(ctx, restic.PackFile, func(id restic.ID, size int64) error {
|
return repo.List(ctx, restic.PackFile, func(id restic.ID, size int64) error {
|
||||||
h := restic.Handle{Type: restic.PackFile, Name: id.String()}
|
blobs, _, err := repo.ListPack(ctx, id, size)
|
||||||
|
|
||||||
blobs, _, err := pack.List(repo.Key(), backend.ReaderAt(ctx, repo.Backend(), h), size)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Warnf("error for pack %v: %v\n", id.Str(), err)
|
Warnf("error for pack %v: %v\n", id.Str(), err)
|
||||||
return nil
|
return nil
|
||||||
@ -312,14 +310,14 @@ func decryptUnsigned(ctx context.Context, k *crypto.Key, buf []byte) []byte {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadBlobs(ctx context.Context, repo restic.Repository, pack restic.ID, list []restic.Blob) error {
|
func loadBlobs(ctx context.Context, repo restic.Repository, packID restic.ID, list []restic.Blob) error {
|
||||||
dec, err := zstd.NewReader(nil)
|
dec, err := zstd.NewReader(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
be := repo.Backend()
|
be := repo.Backend()
|
||||||
h := restic.Handle{
|
h := restic.Handle{
|
||||||
Name: pack.String(),
|
Name: packID.String(),
|
||||||
Type: restic.PackFile,
|
Type: restic.PackFile,
|
||||||
}
|
}
|
||||||
for _, blob := range list {
|
for _, blob := range list {
|
||||||
@ -527,7 +525,7 @@ func examinePack(ctx context.Context, repo restic.Repository, id restic.ID) erro
|
|||||||
Printf(" ========================================\n")
|
Printf(" ========================================\n")
|
||||||
Printf(" inspect the pack itself\n")
|
Printf(" inspect the pack itself\n")
|
||||||
|
|
||||||
blobs, _, err := pack.List(repo.Key(), backend.ReaderAt(ctx, repo.Backend(), h), fi.Size)
|
blobs, _, err := repo.ListPack(ctx, id, fi.Size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("pack %v: %v", id.Str(), err)
|
return fmt.Errorf("pack %v: %v", id.Str(), err)
|
||||||
}
|
}
|
||||||
@ -558,7 +556,7 @@ func checkPackSize(blobs []restic.Blob, fileSize int64) {
|
|||||||
size += uint64(pack.CalculateHeaderSize(blobs))
|
size += uint64(pack.CalculateHeaderSize(blobs))
|
||||||
|
|
||||||
if uint64(fileSize) != size {
|
if uint64(fileSize) != size {
|
||||||
Printf(" file sizes do not match: computed %v from index, file size is %v\n", size, fileSize)
|
Printf(" file sizes do not match: computed %v, file size is %v\n", size, fileSize)
|
||||||
} else {
|
} else {
|
||||||
Printf(" file sizes match\n")
|
Printf(" file sizes match\n")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user