(ctx context.Context, rep repo.DirectRepositoryWriter)
| 31 | } |
| 32 | |
| 33 | func (c *commandIndexOptimize) runOptimizeCommand(ctx context.Context, rep repo.DirectRepositoryWriter) error { |
| 34 | c.svc.dangerousCommand() |
| 35 | |
| 36 | contentIDs, err := toContentIDs(c.optimizeDropContents) |
| 37 | if err != nil { |
| 38 | return err |
| 39 | } |
| 40 | |
| 41 | opt := indexblob.CompactOptions{ |
| 42 | MaxSmallBlobs: c.optimizeMaxSmallBlobs, |
| 43 | AllIndexes: c.optimizeAllIndexes, |
| 44 | DropContents: contentIDs, |
| 45 | } |
| 46 | |
| 47 | if age := c.optimizeDropDeletedOlderThan; age > 0 { |
| 48 | opt.DropDeletedBefore = rep.Time().Add(-age) |
| 49 | } |
| 50 | |
| 51 | _, err = rep.ContentManager().CompactIndexes(ctx, opt) |
| 52 | |
| 53 | return errors.Wrap(err, "error optimizing indexes") |
| 54 | } |
nothing calls this directly
no test coverage detected