TransfromQuantityToJindoUnit transform a given input quantity to another one that can be recognized by Jindo.
(q *resource.Quantity)
| 40 | // TransfromQuantityToJindoUnit transform a given input quantity to another one |
| 41 | // that can be recognized by Jindo. |
| 42 | func 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.) |