Package org.elasticsearch.common.unit
Class RelativeByteSizeValue
java.lang.Object
org.elasticsearch.common.unit.RelativeByteSizeValue
public class RelativeByteSizeValue
extends java.lang.Object
A byte size value that allows specification using either of:
1. Absolute value (200GB for instance)
2. Relative percentage value (95%)
3. Relative ratio value (0.95)
-
Field Summary
Fields Modifier and Type Field Description static RelativeByteSizeValue
ZERO
-
Constructor Summary
Constructors Constructor Description RelativeByteSizeValue(ByteSizeValue absolute)
RelativeByteSizeValue(RatioValue ratio)
-
Method Summary
Modifier and Type Method Description ByteSizeValue
calculateValue(ByteSizeValue total, ByteSizeValue maxHeadroom)
Calculate the size to use, optionally catering for a max headroom.ByteSizeValue
getAbsolute()
RatioValue
getRatio()
java.lang.String
getStringRep()
boolean
isAbsolute()
boolean
isNonZeroSize()
static RelativeByteSizeValue
parseRelativeByteSizeValue(java.lang.String value, java.lang.String settingName)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
ZERO
-
-
Constructor Details
-
RelativeByteSizeValue
-
RelativeByteSizeValue
-
-
Method Details
-
isAbsolute
public boolean isAbsolute() -
getAbsolute
-
getRatio
-
calculateValue
Calculate the size to use, optionally catering for a max headroom.- Parameters:
total
- the total size to usemaxHeadroom
- the max headroom to cater for or null (or -1) to ignore.- Returns:
- the size to use
-
isNonZeroSize
public boolean isNonZeroSize() -
parseRelativeByteSizeValue
public static RelativeByteSizeValue parseRelativeByteSizeValue(java.lang.String value, java.lang.String settingName) -
getStringRep
public java.lang.String getStringRep()
-