Package org.elasticsearch.common
Class FieldMemoryStats
- java.lang.Object
-
- org.elasticsearch.common.FieldMemoryStats
-
- All Implemented Interfaces:
Iterable<ObjectLongCursor<String>>,Writeable
public final class FieldMemoryStats extends Object implements Writeable, Iterable<ObjectLongCursor<String>>
A reusable class to encodefield -> memory sizemappings
-
-
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(ObjectLongHashMap<String> stats)Creates a new FieldMemoryStats instanceFieldMemoryStats(StreamInput input)Creates a new FieldMemoryStats instance from a stream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(FieldMemoryStats fieldMemoryStats)Adds / merges the given field memory stats into this stats instancebooleancontainsField(String field)Returnstrueiff the given field is in the statsFieldMemoryStatscopy()Creates a deep copy of this stats instancebooleanequals(Object o)longget(String field)Returns the fields value in bytes or0if it's not present in the statsinthashCode()Iterator<ObjectLongCursor<String>>iterator()voidtoXContent(XContentBuilder builder, String key, String rawKey, 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.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
FieldMemoryStats
public FieldMemoryStats(ObjectLongHashMap<String> stats)
Creates a new FieldMemoryStats instance
-
FieldMemoryStats
public FieldMemoryStats(StreamInput input) throws IOException
Creates a new FieldMemoryStats instance from a stream- Throws:
IOException
-
-
Method Detail
-
add
public void add(FieldMemoryStats fieldMemoryStats)
Adds / merges the given field memory stats into this stats instance
-
writeTo
public void writeTo(StreamOutput out) throws IOException
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContent
public void toXContent(XContentBuilder builder, String key, String rawKey, String readableKey) throws IOException
Generates 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:
IOException
-
copy
public FieldMemoryStats copy()
Creates a deep copy of this stats instance
-
iterator
public Iterator<ObjectLongCursor<String>> iterator()
- Specified by:
iteratorin interfaceIterable<ObjectLongCursor<String>>
-
get
public long get(String field)
Returns the fields value in bytes or0if it's not present in the stats
-
containsField
public boolean containsField(String field)
Returnstrueiff the given field is in the stats
-
-