Пример #1
0
 @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);
 }
Пример #2
0
 @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);
 }
Пример #3
0
 @Override
 public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
   builder.field("timestamp", getTimestamp());
   builder.field(Fields.CLUSTER_NAME, getClusterName().value());
   if (params.paramAsBoolean("output_uuid", false)) {
     builder.field(Fields.UUID, clusterUUID);
   }
   if (status != null) {
     builder.field(Fields.STATUS, status.name().toLowerCase(Locale.ROOT));
   }
   builder.startObject(Fields.INDICES);
   indicesStats.toXContent(builder, params);
   builder.endObject();
   builder.startObject(Fields.NODES);
   nodesStats.toXContent(builder, params);
   builder.endObject();
   return builder;
 }
Пример #4
0
 public static ClusterStatsNodes readNodeStats(StreamInput in) throws IOException {
   ClusterStatsNodes nodeStats = new ClusterStatsNodes();
   nodeStats.readFrom(in);
   return nodeStats;
 }