Add ByteSizeValue to SegmentStats.

This commit is contained in:
Andrew Raines 2014-01-03 09:22:39 -06:00
parent d657dc49b2
commit 125ac4f92f
1 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import org.elasticsearch.Version;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentBuilderString;
@ -68,6 +69,10 @@ public class SegmentsStats implements Streamable, ToXContent {
return this.memoryInBytes; return this.memoryInBytes;
} }
public ByteSizeValue getMemory() {
return new ByteSizeValue(memoryInBytes);
}
public static SegmentsStats readSegmentsStats(StreamInput in) throws IOException { public static SegmentsStats readSegmentsStats(StreamInput in) throws IOException {
SegmentsStats stats = new SegmentsStats(); SegmentsStats stats = new SegmentsStats();
stats.readFrom(in); stats.readFrom(in);