MCPcopy Index your code
hub / github.com/kopia/kopia / run

Method run

cli/command_maintenance_info.go:35–104  ·  view source on GitHub ↗
(ctx context.Context, rep repo.DirectRepository)

Source from the content-addressed store, hash-verified

33}
34
35func (c *commandMaintenanceInfo) run(ctx context.Context, rep repo.DirectRepository) error {
36 p, err := maintenance.GetParams(ctx, rep)
37 if err != nil {
38 return errors.Wrap(err, "unable to get maintenance params")
39 }
40
41 s, err := maintenance.GetSchedule(ctx, rep)
42 if err != nil {
43 return errors.Wrap(err, "unable to get maintenance schedule")
44 }
45
46 if c.jo.jsonOutput {
47 mi := MaintenanceInfo{
48 Params: *p,
49 Schedule: *s,
50 }
51
52 c.out.printStdout("%s\n", c.jo.jsonBytes(mi))
53
54 return nil
55 }
56
57 c.out.printStdout("Owner: %v\n", p.Owner)
58 c.out.printStdout("Quick Cycle:\n")
59 c.displayCycleInfo(&p.QuickCycle, s.NextQuickMaintenanceTime, rep)
60
61 c.out.printStdout("Full Cycle:\n")
62 c.displayCycleInfo(&p.FullCycle, s.NextFullMaintenanceTime, rep)
63
64 cl := p.LogRetention.OrDefault()
65
66 c.out.printStdout("Log Retention:\n")
67 c.out.printStdout(" max count: %v\n", cl.MaxCount)
68 c.out.printStdout(" max age of logs: %v\n", cl.MaxAge)
69 c.out.printStdout(" max total size: %v\n", units.BytesString(cl.MaxTotalSize))
70
71 if p.ExtendObjectLocks {
72 c.out.printStdout("Object Lock Extension: enabled\n")
73 } else {
74 c.out.printStdout("Object Lock Extension: disabled\n")
75 }
76
77 if p.ListParallelism != 0 {
78 c.out.printStdout("List parallelism: %v\n", p.ListParallelism)
79 }
80
81 c.out.printStdout("Recent Maintenance Runs:\n")
82
83 for run, timings := range s.Runs {
84 c.out.printStdout(" %v:\n", run)
85
86 for _, t := range timings {
87 var message string
88
89 if t.Success {
90 message = getMessageFromRun(t.Extra)
91 } else {
92 message = "ERROR: " + t.Error

Callers

nothing calls this directly

Calls 10

displayCycleInfoMethod · 0.95
GetParamsFunction · 0.92
GetScheduleFunction · 0.92
BytesStringFunction · 0.92
getMessageFromRunFunction · 0.85
formatTimestampFunction · 0.85
printStdoutMethod · 0.80
jsonBytesMethod · 0.80
SubMethod · 0.80
OrDefaultMethod · 0.45

Tested by

no test coverage detected