restic: change ListBlobs to return PackBlob

PackBlob is a limited interface that only exposes a part of the
information provided by PackedBlob. Most of the changes are switches
from direct value lookups to the interface methods, with a few larger
changes to let the tests still work.
This commit is contained in:
Michael Eischer committed 2026-06-13 17:54:38 +02:00
1 parent 97f1e99ed9
commit ccb5ae1592
15 files changed
+102 -73

No files matched your search

+7 -5
View File
@@ -87,16 +87,18 @@ func NewChecker(repo *Repository) *Checker {
}
func computePackTypes(ctx context.Context, idx restic.ListBlobser) (map[restic.ID]restic.BlobType, error) {
packs := make(map[restic.ID]restic.BlobType)
err := idx.ListBlobs(ctx, func(pb restic.PackedBlob) {
tpe, exists := packs[pb.PackID]
err := idx.ListBlobs(ctx, func(pb restic.PackBlob) {
packID := pb.PackID()
h := pb.Handle()
tpe, exists := packs[packID]
if exists {
if pb.Type != tpe {
if h.Type != tpe {
tpe = restic.InvalidBlob
}
} else {
tpe = pb.Type
tpe = h.Type
}
packs[pb.PackID] = tpe
packs[packID] = tpe
})
return packs, err
}