mirror of
https://github.com/restic/restic.git
synced 2025-12-11 18:47:50 +00:00
check: refactor pack selection for read data
Drop the `packs` map from the internal state of the checker. Instead the Packs(...) method now calls a filter callback that can select the packs intended for checking.
This commit is contained in:
@@ -60,7 +60,9 @@ func checkData(chkr *checker.Checker) []error {
|
||||
return collectErrors(
|
||||
context.TODO(),
|
||||
func(ctx context.Context, errCh chan<- error) {
|
||||
chkr.ReadData(ctx, errCh)
|
||||
chkr.ReadPacks(ctx, func(packs map[restic.ID]int64) map[restic.ID]int64 {
|
||||
return packs
|
||||
}, nil, errCh)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package checker
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/internal/restic"
|
||||
)
|
||||
|
||||
// TestCheckRepo runs the checker on repo.
|
||||
@@ -50,7 +52,9 @@ func TestCheckRepo(t testing.TB, repo checkerRepository) {
|
||||
|
||||
// read data
|
||||
errChan = make(chan error)
|
||||
go chkr.ReadData(context.TODO(), errChan)
|
||||
go chkr.ReadPacks(context.TODO(), func(packs map[restic.ID]int64) map[restic.ID]int64 {
|
||||
return packs
|
||||
}, nil, errChan)
|
||||
|
||||
for err := range errChan {
|
||||
t.Error(err)
|
||||
|
||||
Reference in New Issue
Block a user