repository: replace SetIndex method with internal loadIndexWithCallback method

This commit is contained in:
Michael Eischer
2025-09-28 15:10:57 +02:00
parent f0955fa931
commit 4426dfe6a9
4 changed files with 10 additions and 46 deletions

View File

@@ -80,15 +80,10 @@ func computePackTypes(ctx context.Context, idx restic.ListBlobser) (map[restic.I
// LoadIndex loads all index files.
func (c *Checker) LoadIndex(ctx context.Context, p restic.TerminalCounterFactory) (hints []error, errs []error) {
debug.Log("Start")
var bar *progress.Counter
if p != nil {
bar = p.NewCounterTerminalOnly("index files loaded")
}
packToIndex := make(map[restic.ID]restic.IDSet)
masterIndex := index.NewMasterIndex()
err := masterIndex.Load(ctx, c.repo, bar, func(id restic.ID, idx *index.Index, err error) error {
// Use the repository's internal loadIndexWithCallback to handle per-index errors
err := c.repo.loadIndexWithCallback(ctx, p, func(id restic.ID, idx *index.Index, err error) error {
debug.Log("process index %v, err %v", id, err)
err = errors.Wrapf(err, "error loading index %v", id)
@@ -116,12 +111,6 @@ func (c *Checker) LoadIndex(ctx context.Context, p restic.TerminalCounterFactory
return hints, append(errs, err)
}
err = c.repo.SetIndex(masterIndex)
if err != nil {
debug.Log("SetIndex returned error: %v", err)
errs = append(errs, err)
}
// compute pack size using index entries
c.packs, err = pack.Size(ctx, c.repo, false)
if err != nil {