package console import ( "context" "git.golem15.com/golem15/summercms/modules/bonfire" "gorm.io/gorm" ) // ReindexRun exposes one reindex walk to the console_test package. type ReindexRun struct{ r *reindexRun } // NewReindexRun is a walk with deps' Backfill and the given sync. func NewReindexRun(deps MaterialsReindexDeps, sync func(id uint) error, out bonfire.Output) ReindexRun { return ReindexRun{r: &reindexRun{backfill: deps.Backfill, sync: sync, out: out}} } // Material runs the per-material step. func (w ReindexRun) Material(ctx context.Context, db *gorm.DB, id uint) { w.r.material(ctx, db, id) } // Counts are the run's counters and the tool-missing flag. func (w ReindexRun) Counts() (synced, failed int, noTool bool) { return w.r.synced, w.r.failed, w.r.noTool }