MCPcopy
hub / github.com/kopia/kopia / setThrottleFloat64

Method setThrottleFloat64

cli/throttle_set.go:62–94  ·  view source on GitHub ↗
(ctx context.Context, desc string, bps bool, val *float64, str string, changeCount *int)

Source from the content-addressed store, hash-verified

60}
61
62func (c *commonThrottleSet) setThrottleFloat64(ctx context.Context, desc string, bps bool, val *float64, str string, changeCount *int) error {
63 if str == "" {
64 // not changed
65 return nil
66 }
67
68 if str == "unlimited" || str == "-" {
69 *changeCount++
70
71 log(ctx).Infof("Setting %v to a unlimited.", desc)
72
73 *val = 0
74
75 return nil
76 }
77
78 v, err := strconv.ParseFloat(str, 64)
79 if err != nil {
80 return errors.Wrapf(err, "can't parse the %v %q", desc, str)
81 }
82
83 *changeCount++
84
85 if bps {
86 log(ctx).Infof("Setting %v to %v.", desc, units.BytesPerSecondsString(v))
87 } else {
88 log(ctx).Infof("Setting %v to %v.", desc, v)
89 }
90
91 *val = v
92
93 return nil
94}
95
96func (c *commonThrottleSet) setThrottleInt(ctx context.Context, desc string, val *int, str string, changeCount *int) error {
97 if str == "" {

Callers 1

applyMethod · 0.95

Calls 1

BytesPerSecondsStringFunction · 0.92

Tested by

no test coverage detected