mirror of
https://github.com/restic/restic.git
synced 2026-11-21 13:02:42 +00:00
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:
1 parent
97f1e99ed9
commit
ccb5ae1592
15 files changed
+102
-73
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user