@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeVInt(nodes.length); for (NodeStats node : nodes) { node.writeTo(out); } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); nodes = new NodeStats[in.readVInt()]; for (int i = 0; i < nodes.length; i++) { nodes[i] = NodeStats.readNodeStats(in); } }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeVLong(timestamp); if (status == null) { out.writeBoolean(false); } else { out.writeBoolean(true); out.writeByte(status.value()); } out.writeString(clusterUUID); nodesStats.writeTo(out); indicesStats.writeTo(out); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); timestamp = in.readVLong(); status = null; if (in.readBoolean()) { // it may be that the master switched on us while doing the operation. In this case the status // may be null. status = ClusterHealthStatus.fromValue(in.readByte()); } clusterUUID = in.readString(); nodesStats = ClusterStatsNodes.readNodeStats(in); indicesStats = ClusterStatsIndices.readIndicesStats(in); }