Skip to content

Commit 0cacdc7

Browse files
committed
Remove unused serialization interface/methods
1 parent 63bbea8 commit 0cacdc7

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

server/src/main/java/org/elasticsearch/cluster/ShardHeapUsage.java

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,13 @@
1212
import org.elasticsearch.common.io.stream.StreamInput;
1313
import org.elasticsearch.common.io.stream.StreamOutput;
1414
import org.elasticsearch.common.io.stream.Writeable;
15-
import org.elasticsearch.common.unit.ByteSizeValue;
16-
import org.elasticsearch.xcontent.ToXContentFragment;
17-
import org.elasticsearch.xcontent.XContentBuilder;
1815

1916
import java.io.IOException;
2017

2118
/**
2219
* Record representing an estimate of the heap used by allocated shards and ongoing merges on a particular node
2320
*/
24-
public record ShardHeapUsage(String nodeId, String nodeName, long totalBytes, long estimatedUsageBytes)
25-
implements
26-
ToXContentFragment,
27-
Writeable {
21+
public record ShardHeapUsage(String nodeId, String nodeName, long totalBytes, long estimatedUsageBytes) implements Writeable {
2822

2923
public ShardHeapUsage {
3024
assert estimatedUsageBytes <= totalBytes;
@@ -42,36 +36,7 @@ public void writeTo(StreamOutput out) throws IOException {
4236
out.writeVLong(this.estimatedUsageBytes);
4337
}
4438

45-
public XContentBuilder toShortXContent(XContentBuilder builder) throws IOException {
46-
builder.field("node_name", this.nodeName);
47-
builder.humanReadableField("total_heap_bytes", "total", ByteSizeValue.ofBytes(this.totalBytes));
48-
builder.humanReadableField("estimated_usage_bytes", "used", ByteSizeValue.ofBytes(this.estimatedUsageBytes));
49-
builder.humanReadableField("estimated_free_bytes", "free", ByteSizeValue.ofBytes(this.estimatedFreeBytes()));
50-
builder.field("estimated_free_percent", truncatePercent(this.freeHeapAsPercentage()));
51-
builder.field("estimated_usage_percent", truncatePercent(this.estimatedUsageAsPercentage()));
52-
return builder;
53-
}
54-
55-
@Override
56-
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
57-
builder.field("node_id", this.nodeId);
58-
toShortXContent(builder);
59-
return builder;
60-
}
61-
62-
public double freeHeapAsPercentage() {
63-
return 100.0 - estimatedUsageAsPercentage();
64-
}
65-
66-
public double estimatedUsageAsPercentage() {
67-
return 100.0 * estimatedUsageBytes / (double) totalBytes;
68-
}
69-
7039
public long estimatedFreeBytes() {
7140
return totalBytes - estimatedUsageBytes;
7241
}
73-
74-
private static double truncatePercent(double pct) {
75-
return Math.round(pct * 10.0) / 10.0;
76-
}
7742
}

0 commit comments

Comments
 (0)