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 void
add(FieldMemoryStats fieldMemoryStats)
Adds / merges the given field memory stats into this stats instanceboolean
containsField(java.lang.String field)
Returnstrue
iff the given field is in the statsFieldMemoryStats
copy()
Creates a deep copy of this stats instanceboolean
equals(java.lang.Object o)
long
get(java.lang.String field)
Returns the fields value in bytes or0
if it's not present in the statsint
hashCode()
java.util.Iterator<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>>
iterator()
void
toXContent(org.elasticsearch.common.xcontent.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 instancevoid
writeTo(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:Writeable
Write this into the StreamOutput. -
toXContent
public void toXContent(org.elasticsearch.common.xcontent.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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
iterator
public java.util.Iterator<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>> iterator()- Specified by:
iterator
in 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 or0
if it's not present in the stats -
containsField
public boolean containsField(java.lang.String field)Returnstrue
iff the given field is in the stats
-