MCPcopy
hub / github.com/kopia/kopia / runOptimizeCommand

Method runOptimizeCommand

cli/command_index_optimize.go:33–54  ·  view source on GitHub ↗
(ctx context.Context, rep repo.DirectRepositoryWriter)

Source from the content-addressed store, hash-verified

31}
32
33func (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}

Callers

nothing calls this directly

Calls 6

toContentIDsFunction · 0.85
CompactIndexesMethod · 0.80
dangerousCommandMethod · 0.65
TimeMethod · 0.65
ContentManagerMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected