java.lang.Object
org.elasticsearch.common.unit.RelativeByteSizeValue
- All Implemented Interfaces:
Writeable
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)
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
ConstructorsConstructorDescriptionRelativeByteSizeValue(ByteSizeValue absolute) RelativeByteSizeValue(RatioValue ratio) -
Method Summary
Modifier and TypeMethodDescriptioncalculateValue(ByteSizeValue total, ByteSizeValue maxHeadroom) Calculate the size to use, optionally catering for a max headroom.getRatio()booleanbooleanstatic RelativeByteSizeValueparseRelativeByteSizeValue(String value, String settingName) static RelativeByteSizeValuereadFrom(StreamInput in) voidwriteTo(StreamOutput out) Write this into the StreamOutput.
-
Constructor Details
-
RelativeByteSizeValue
-
RelativeByteSizeValue
-
-
Method Details
-
isAbsolute
public boolean isAbsolute() -
getAbsolute
-
getRatio
-
calculateValue
Calculate the size to use, optionally catering for a max headroom. If a ratio/percentage is used, the resulting bytes are rounded to the next integer value.- 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
-
getStringRep
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
readFrom
- Throws:
IOException
-