MCPcopy
hub / github.com/fluid-cloudnative/fluid / TransformQuantityToJindoUnit

Function TransformQuantityToJindoUnit

pkg/utils/quantity.go:42–51  ·  view source on GitHub ↗

TransfromQuantityToJindoUnit transform a given input quantity to another one that can be recognized by Jindo.

(q *resource.Quantity)

Source from the content-addressed store, hash-verified

40// TransfromQuantityToJindoUnit transform a given input quantity to another one
41// that can be recognized by Jindo.
42func TransformQuantityToJindoUnit(q *resource.Quantity) (value string) {
43 value = q.String()
44 if strings.HasSuffix(value, "Gi") {
45 value = strings.ReplaceAll(value, "Gi", "g")
46 }
47 if strings.HasSuffix(value, "Mi") {
48 value = strings.ReplaceAll(value, "Mi", "m")
49 }
50 return
51}
52
53// TransformQuantityToGooseFSUnit transform a given input quantity to another one
54// that can be recognized by GooseFS. This is necessary because GooseFS takes decimal byte units(e.g. KB, MB, GB, etc.)

Callers 4

transformMethod · 0.92
transformMethod · 0.92
transformMethod · 0.92

Calls 1

StringMethod · 0.45

Tested by 1