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
2026-06-13 17:54:38 +02:00
parent 97f1e99ed9
commit ccb5ae1592
15 changed files with 102 additions and 73 deletions
+2 -2
View File
@@ -683,12 +683,12 @@ func (r *Repository) LookupBlobSize(tpe restic.BlobType, id restic.ID) (uint, bo
// ListBlobs runs fn on all blobs known to the index. When the context is cancelled,
// the index iteration returns immediately with ctx.Err(). This blocks any modification of the index.
func (r *Repository) ListBlobs(ctx context.Context, fn func(restic.PackedBlob)) error {
func (r *Repository) ListBlobs(ctx context.Context, fn func(restic.PackBlob)) error {
for blob := range r.idx.Values() {
if ctx.Err() != nil {
return ctx.Err()
}
fn(blob)
fn(restic.AsPackBlob(blob))
}
return nil
}