index: replace custom EachByPackResult datatype

This commit is contained in:
Michael Eischer
2026-05-30 10:11:18 +02:00
parent c669cc7a7d
commit 2a95591b48
+3 -8
View File
@@ -228,11 +228,6 @@ func (idx *Index) Values() iter.Seq[restic.PackedBlob] {
}
}
type EachByPackResult struct {
PackID restic.ID
Blobs restic.Blobs
}
// EachByPack returns a channel that yields all blobs known to the index
// grouped by packID but ignoring blobs with a packID in packPlacklist for
// finalized indexes.
@@ -240,10 +235,10 @@ type EachByPackResult struct {
// from the finalized index which have been re-read into a non-finalized index.
// When the context is cancelled, the background goroutine
// terminates. This blocks any modification of the index.
func (idx *Index) EachByPack(ctx context.Context, packBlacklist restic.IDSet) <-chan EachByPackResult {
func (idx *Index) EachByPack(ctx context.Context, packBlacklist restic.IDSet) <-chan restic.PackBlobs {
idx.m.RLock()
ch := make(chan EachByPackResult)
ch := make(chan restic.PackBlobs)
go func() {
defer idx.m.RUnlock()
@@ -264,7 +259,7 @@ func (idx *Index) EachByPack(ctx context.Context, packBlacklist restic.IDSet) <-
}
for packID, packByType := range byPack {
var result EachByPackResult
var result restic.PackBlobs
result.PackID = packID
for typ, p := range packByType {
for _, e := range p {