TransformQuantityToGooseFSUnit transform a given input quantity to another one that can be recognized by GooseFS. This is necessary because GooseFS takes decimal byte units(e.g. KB, MB, GB, etc.) as binary byte units(e.g. Ki, Mi, Gi)
(q *resource.Quantity)
| 54 | // that can be recognized by GooseFS. This is necessary because GooseFS takes decimal byte units(e.g. KB, MB, GB, etc.) |
| 55 | // as binary byte units(e.g. Ki, Mi, Gi) |
| 56 | func TransformQuantityToGooseFSUnit(q *resource.Quantity) (value string) { |
| 57 | value = q.String() |
| 58 | |
| 59 | if strings.HasSuffix(value, "i") { |
| 60 | value = strings.ReplaceAll(value, "i", "B") |
| 61 | } |
| 62 | return |
| 63 | // return units.BytesSize(units.BytesSize(float64(q.Value()))) |
| 64 | |
| 65 | } |
| 66 | |
| 67 | // TransformQuantityToEFCUnit transform a given input quantity to another one |
| 68 | // that can be recognized by EFC. This is necessary because EFC takes decimal byte units(e.g. KB, MB, GB, etc.) |