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)
| 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) |
| 29 | func 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. |