Remove unnecessary fromValue method for ClusterHealthStatus (#53893)
We use readFrom as a standard name for deserializing an object, but ClusterHealthStatus also had a `fromValue` method which was used during outer deserialization. This commit collapses the two methods together. closes #53569
This commit is contained in:
parent
6332c40a2c
commit
290d58b1b0
|
@ -73,7 +73,7 @@ public class ClusterHealthRequest extends MasterNodeReadRequest<ClusterHealthReq
|
|||
}
|
||||
timeout = in.readTimeValue();
|
||||
if (in.readBoolean()) {
|
||||
waitForStatus = ClusterHealthStatus.fromValue(in.readByte());
|
||||
waitForStatus = ClusterHealthStatus.readFrom(in);
|
||||
}
|
||||
waitForNoRelocatingShards = in.readBoolean();
|
||||
waitForActiveShards = ActiveShardCount.readFrom(in);
|
||||
|
|
|
@ -147,7 +147,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
|
|||
public ClusterHealthResponse(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
clusterName = in.readString();
|
||||
clusterHealthStatus = ClusterHealthStatus.fromValue(in.readByte());
|
||||
clusterHealthStatus = ClusterHealthStatus.readFrom(in);
|
||||
clusterStateHealth = new ClusterStateHealth(in);
|
||||
numberOfPendingTasks = in.readInt();
|
||||
timedOut = in.readBoolean();
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ClusterStatsNodeResponse extends BaseNodeResponse {
|
|||
super(in);
|
||||
clusterStatus = null;
|
||||
if (in.readBoolean()) {
|
||||
clusterStatus = ClusterHealthStatus.fromValue(in.readByte());
|
||||
clusterStatus = ClusterHealthStatus.readFrom(in);
|
||||
}
|
||||
this.nodeInfo = new NodeInfo(in);
|
||||
this.nodeStats = new NodeStats(in);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class IndicesShardStoresRequest extends MasterNodeReadRequest<IndicesShar
|
|||
int nStatus = in.readVInt();
|
||||
statuses = EnumSet.noneOf(ClusterHealthStatus.class);
|
||||
for (int i = 0; i < nStatus; i++) {
|
||||
statuses.add(ClusterHealthStatus.fromValue(in.readByte()));
|
||||
statuses.add(ClusterHealthStatus.readFrom(in));
|
||||
}
|
||||
indicesOptions = IndicesOptions.readIndicesOptions(in);
|
||||
}
|
||||
|
|
|
@ -52,10 +52,7 @@ public enum ClusterHealthStatus implements Writeable {
|
|||
* @throws IllegalArgumentException if the value is unrecognized
|
||||
*/
|
||||
public static ClusterHealthStatus readFrom(StreamInput in) throws IOException {
|
||||
return fromValue(in.readByte());
|
||||
}
|
||||
|
||||
public static ClusterHealthStatus fromValue(byte value) throws IOException {
|
||||
byte value = in.readByte();
|
||||
switch (value) {
|
||||
case 0:
|
||||
return GREEN;
|
||||
|
|
|
@ -165,7 +165,7 @@ public final class ClusterIndexHealth implements Iterable<ClusterShardHealth>, W
|
|||
relocatingShards = in.readVInt();
|
||||
initializingShards = in.readVInt();
|
||||
unassignedShards = in.readVInt();
|
||||
status = ClusterHealthStatus.fromValue(in.readByte());
|
||||
status = ClusterHealthStatus.readFrom(in);
|
||||
|
||||
int size = in.readVInt();
|
||||
shards = new HashMap<>(size);
|
||||
|
|
|
@ -121,7 +121,7 @@ public final class ClusterShardHealth implements Writeable, ToXContentFragment {
|
|||
|
||||
public ClusterShardHealth(final StreamInput in) throws IOException {
|
||||
shardId = in.readVInt();
|
||||
status = ClusterHealthStatus.fromValue(in.readByte());
|
||||
status = ClusterHealthStatus.readFrom(in);
|
||||
activeShards = in.readVInt();
|
||||
relocatingShards = in.readVInt();
|
||||
initializingShards = in.readVInt();
|
||||
|
|
|
@ -134,7 +134,7 @@ public final class ClusterStateHealth implements Iterable<ClusterIndexHealth>, W
|
|||
unassignedShards = in.readVInt();
|
||||
numberOfNodes = in.readVInt();
|
||||
numberOfDataNodes = in.readVInt();
|
||||
status = ClusterHealthStatus.fromValue(in.readByte());
|
||||
status = ClusterHealthStatus.readFrom(in);
|
||||
int size = in.readVInt();
|
||||
indices = new HashMap<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
|
Loading…
Reference in New Issue