MCPcopy
hub / github.com/restic/restic / rewriteIndexFiles

Function rewriteIndexFiles

internal/repository/repair_index.go:106–123  ·  view source on GitHub ↗
(ctx context.Context, repo *Repository, removePacks restic.IDSet, oldIndexes restic.IDSet, extraObsolete restic.IDs, printer progress.Printer)

Source from the content-addressed store, hash-verified

104}
105
106func rewriteIndexFiles(ctx context.Context, repo *Repository, removePacks restic.IDSet, oldIndexes restic.IDSet, extraObsolete restic.IDs, printer progress.Printer) error {
107 printer.P("rebuilding index\n")
108
109 bar := printer.NewCounter("indexes processed")
110 return repo.idx.Rewrite(ctx, &internalRepository{repo}, removePacks, oldIndexes, extraObsolete, index.MasterIndexRewriteOpts{
111 SaveProgress: bar,
112 DeleteProgress: func() *progress.Counter {
113 return printer.NewCounter("old indexes deleted")
114 },
115 DeleteReport: func(id restic.ID, err error) {
116 if err != nil {
117 printer.VV("failed to remove index %v: %v\n", id.String(), err)
118 } else {
119 printer.VV("removed index %v\n", id.String())
120 }
121 },
122 })
123}

Callers 3

RepairPacksFunction · 0.85
RepairIndexFunction · 0.85
ExecuteMethod · 0.85

Calls 5

RewriteMethod · 0.80
PMethod · 0.65
NewCounterMethod · 0.65
VVMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected