Package org.elasticsearch.common
Class FieldMemoryStats
java.lang.Object
org.elasticsearch.common.FieldMemoryStats
- All Implemented Interfaces:
java.lang.Iterable<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>>,Writeable
public final class FieldMemoryStats extends java.lang.Object implements Writeable, java.lang.Iterable<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>>
A reusable class to encode
field -> memory size mappings-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
Constructors Constructor Description FieldMemoryStats(com.carrotsearch.hppc.ObjectLongHashMap<java.lang.String> stats)Creates a new FieldMemoryStats instanceFieldMemoryStats(StreamInput input)Creates a new FieldMemoryStats instance from a stream -
Method Summary
Modifier and Type Method Description voidadd(FieldMemoryStats fieldMemoryStats)Adds / merges the given field memory stats into this stats instancebooleancontainsField(java.lang.String field)Returnstrueiff the given field is in the statsFieldMemoryStatscopy()Creates a deep copy of this stats instancebooleanequals(java.lang.Object o)longget(java.lang.String field)Returns the fields value in bytes or0if it's not present in the statsinthashCode()java.util.Iterator<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>>iterator()voidtoXContent(XContentBuilder builder, java.lang.String key, java.lang.String rawKey, java.lang.String readableKey)Generates x-content into the given builder for each of the fields in this stats instancevoidwriteTo(StreamOutput out)Write this into the StreamOutput.
-
Constructor Details
-
FieldMemoryStats
public FieldMemoryStats(com.carrotsearch.hppc.ObjectLongHashMap<java.lang.String> stats)Creates a new FieldMemoryStats instance -
FieldMemoryStats
Creates a new FieldMemoryStats instance from a stream- Throws:
java.io.IOException
-
-
Method Details
-
add
Adds / merges the given field memory stats into this stats instance -
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput. -
toXContent
public void toXContent(XContentBuilder builder, java.lang.String key, java.lang.String rawKey, java.lang.String readableKey) throws java.io.IOExceptionGenerates x-content into the given builder for each of the fields in this stats instance- Parameters:
builder- the builder to generated onkey- the top level key for this stats objectrawKey- the raw byte key for each of the fields byte sizesreadableKey- the readable key for each of the fields byte sizes- Throws:
java.io.IOException
-
copy
Creates a deep copy of this stats instance -
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
iterator
public java.util.Iterator<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>> iterator()- Specified by:
iteratorin interfacejava.lang.Iterable<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>>
-
get
public long get(java.lang.String field)Returns the fields value in bytes or0if it's not present in the stats -
containsField
public boolean containsField(java.lang.String field)Returnstrueiff the given field is in the stats
-