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

Function TransformQuantityToAlluxioUnit

pkg/utils/quantity.go:29–38  ·  view source on GitHub ↗

TransformQuantityToAlluxioUnit transform a given input quantity to another one that can be recognized by Alluxio. This is necessary because Alluxio takes decimal byte units(e.g. KB, MB, GB, etc.) as binary byte units(e.g. Ki, Mi, Gi)

(q *resource.Quantity)

Source from the content-addressed store, hash-verified

27// that can be recognized by Alluxio. This is necessary because Alluxio takes decimal byte units(e.g. KB, MB, GB, etc.)
28// as binary byte units(e.g. Ki, Mi, Gi)
29func TransformQuantityToAlluxioUnit(q *resource.Quantity) (value string) {
30 value = q.String()
31
32 if strings.HasSuffix(value, "i") {
33 value = strings.ReplaceAll(value, "i", "B")
34 }
35 return
36 // return units.BytesSize(units.BytesSize(float64(q.Value())))
37
38}
39
40// TransfromQuantityToJindoUnit transform a given input quantity to another one
41// that can be recognized by Jindo.

Callers 2

transformCommonPartMethod · 0.92

Calls 1

StringMethod · 0.45

Tested by 1