abhishekagarwal87 commented on a change in pull request #10635:
URL: https://github.com/apache/druid/pull/10635#discussion_r537280742
##########
File path:
core/src/main/java/org/apache/druid/java/util/common/HumanReadableBytes.java
##########
@@ -208,4 +208,108 @@ private static long parseInner(String rawNumber)
throw new IAE("Invalid format or out of range of long: %s", rawNumber);
}
}
+
+ public enum UnitSystem
+ {
+ /**
+ * also known as IEC format
+ * eg: B, KiB, MiB, GiB ...
+ */
+ BINARY_BYTE,
+
+ /**
+ * also known as SI format
+ * eg: B, KB, MB ...
+ */
+ DECIMAL_BYTE,
+
+ /**
+ * simplified SI format without 'B' indicator
+ * eg: K, M, G ...
+ */
+ DECIMAL
+ }
+
+ /**
+ * Returns a human-readable string version of input value
+ *
+ * @param bytes input value. Negative value is also allowed
+ * @param precision [0,3]
+ * @param unitSystem which unit system is adopted to format the input value,
see {@link UnitSystem}
+ * @param hasSpace if it's true, there's an extra space between the number
and the unit suffix
+ */
+ public static String format(long bytes, int precision, UnitSystem
unitSystem, boolean hasSpace)
Review comment:
IMO it's more of a dead param then and should be removed. It can be
added back if druid ever exposes `hasSpace` to user in future.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]