(ctx context.Context, desc string, val **policy.OptionalInt64, str string, changeCount *int)
| 220 | } |
| 221 | |
| 222 | func applyOptionalInt64MiB(ctx context.Context, desc string, val **policy.OptionalInt64, str string, changeCount *int) error { |
| 223 | if str == "" { |
| 224 | // not changed |
| 225 | return nil |
| 226 | } |
| 227 | |
| 228 | if str == inheritPolicyString || str == defaultPolicyString { |
| 229 | *changeCount++ |
| 230 | |
| 231 | log(ctx).Infof(" - resetting %q to a default value inherited from parent.", desc) |
| 232 | |
| 233 | *val = nil |
| 234 | |
| 235 | return nil |
| 236 | } |
| 237 | |
| 238 | v, err := strconv.ParseInt(str, 10, 32) |
| 239 | if err != nil { |
| 240 | return errors.Wrapf(err, "can't parse the %v %q", desc, str) |
| 241 | } |
| 242 | |
| 243 | // convert MiB to bytes |
| 244 | v *= 1 << 20 //nolint:mnd |
| 245 | |
| 246 | i := policy.OptionalInt64(v) |
| 247 | *changeCount++ |
| 248 | |
| 249 | log(ctx).Infof(" - setting %q to %v.", desc, units.BytesString(v)) |
| 250 | |
| 251 | *val = &i |
| 252 | |
| 253 | return nil |
| 254 | } |
| 255 | |
| 256 | func applyPolicyNumber64(ctx context.Context, desc string, val *int64, str string, changeCount *int) error { |
| 257 | if str == "" { |
no test coverage detected