MCPcopy
hub / github.com/kopia/kopia / Run

Function Run

snapshot/snapshotmaintenance/snapshotmaintenance.go:18–38  ·  view source on GitHub ↗

Run runs the complete snapshot and repository maintenance.

(ctx context.Context, dr repo.DirectRepositoryWriter, mode maintenance.Mode, force bool, safety maintenance.SafetyParameters)

Source from the content-addressed store, hash-verified

16
17// Run runs the complete snapshot and repository maintenance.
18func Run(ctx context.Context, dr repo.DirectRepositoryWriter, mode maintenance.Mode, force bool, safety maintenance.SafetyParameters) error {
19 if dr.ClientOptions().ReadOnly {
20 return ErrReadonly
21 }
22
23 dr.LogManager().Enable()
24
25 //nolint:wrapcheck
26 return maintenance.RunExclusive(ctx, dr, mode, force,
27 func(ctx context.Context, runParams maintenance.RunParameters) error {
28 // run snapshot GC before full maintenance
29 if runParams.Mode == maintenance.ModeFull {
30 if err := snapshotgc.Run(ctx, dr, true, safety, runParams.MaintenanceStartTime); err != nil {
31 return errors.Wrap(err, "snapshot GC failure")
32 }
33 }
34
35 //nolint:wrapcheck
36 return maintenance.Run(ctx, runParams, safety)
37 })
38}

Calls 6

RunExclusiveFunction · 0.92
RunFunction · 0.92
RunFunction · 0.92
EnableMethod · 0.80
ClientOptionsMethod · 0.65
LogManagerMethod · 0.65