@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); timestamp = in.readVLong(); // it may be that the master switched on us while doing the operation. In this case the status may be null. status = in.readOptionalWriteable(ClusterHealthStatus::readFrom); }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeVLong(timestamp); out.writeOptionalWriteable(status); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); clusterName = new ClusterName(in); nodes = readNodesFrom(in); failures = in.readList(FailedNodeException::new); }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); clusterName.writeTo(out); writeNodesTo(out, nodes); out.writeList(failures); }
/** * Automatically transform the {@link ToXContent}-compatible, nodes-level {@code response} into a a {@link BytesRestResponse}. * <p> * This looks like: * <code> * { * "_nodes" : { ... }, * "cluster_name" : "...", * ... * } * </code> * * @param builder XContent builder. * @param params XContent parameters. * @param response The nodes-level (plural) response. * @return Never {@code null}. * @throws IOException if building the response causes an issue */ public static <NodesResponse extends BaseNodesResponse & ToXContent> BytesRestResponse nodesResponse(final XContentBuilder builder, final Params params, final NodesResponse response) throws IOException { builder.startObject(); RestActions.buildNodesHeader(builder, params, response); builder.field("cluster_name", response.getClusterName().value()); response.toXContent(builder, params); builder.endObject(); return new BytesRestResponse(RestStatus.OK, builder); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); clusterName = new ClusterName(in); nodes = readNodesFrom(in); failures = in.readList(FailedNodeException::new); }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); clusterName.writeTo(out); writeNodesTo(out, nodes); out.writeList(failures); }
/** * Automatically transform the {@link ToXContent}-compatible, nodes-level {@code response} into a a {@link BytesRestResponse}. * <p> * This looks like: * <code> * { * "_nodes" : { ... }, * "cluster_name" : "...", * ... * } * </code> * * @param builder XContent builder. * @param params XContent parameters. * @param response The nodes-level (plural) response. * @return Never {@code null}. * @throws IOException if building the response causes an issue */ public static <NodesResponse extends BaseNodesResponse & ToXContent> BytesRestResponse nodesResponse(final XContentBuilder builder, final Params params, final NodesResponse response) throws IOException { builder.startObject(); RestActions.buildNodesHeader(builder, params, response); builder.field("cluster_name", response.getClusterName().value()); response.toXContent(builder, params); builder.endObject(); return new BytesRestResponse(RestStatus.OK, builder); }
/** * Create the XContent header for any {@link BaseNodesResponse}. * * @param builder XContent builder. * @param params XContent parameters. * @param response The response containing individual, node-level responses. * @see #buildNodesHeader(XContentBuilder, Params, int, int, int, List) */ public static <NodeResponse extends BaseNodeResponse> void buildNodesHeader(final XContentBuilder builder, final Params params, final BaseNodesResponse<NodeResponse> response) throws IOException { final int successful = response.getNodes().size(); final int failed = response.failures().size(); buildNodesHeader(builder, params, successful + failed, successful, failed, response.failures()); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); timestamp = in.readVLong(); // it may be that the master switched on us while doing the operation. In this case the status may be null. status = in.readOptionalWriteable(ClusterHealthStatus::readFrom); }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeVLong(timestamp); out.writeOptionalWriteable(status); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); clusterName = new ClusterName(in); nodes = readNodesFrom(in); failures = in.readList(FailedNodeException::new); }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); clusterName.writeTo(out); writeNodesTo(out, nodes); out.writeList(failures); }
/** * Automatically transform the {@link ToXContent}-compatible, nodes-level {@code response} into a a {@link BytesRestResponse}. * <p> * This looks like: * <code> * { * "_nodes" : { ... }, * "cluster_name" : "...", * ... * } * </code> * * @param builder XContent builder. * @param params XContent parameters. * @param response The nodes-level (plural) response. * @return Never {@code null}. * @throws IOException if building the response causes an issue */ public static <NodesResponse extends BaseNodesResponse & ToXContent> BytesRestResponse nodesResponse(final XContentBuilder builder, final Params params, final NodesResponse response) throws IOException { builder.startObject(); RestActions.buildNodesHeader(builder, params, response); builder.field("cluster_name", response.getClusterName().value()); response.toXContent(builder, params); builder.endObject(); return new BytesRestResponse(RestStatus.OK, builder); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); nodes = new ClearFilterJoinCacheNodeResponse[in.readVInt()]; for (int i = 0; i < nodes.length; i++) { nodes[i] = ClearFilterJoinCacheNodeResponse.readNodeInfo(in); } }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeVLong(timestamp); out.writeOptionalWriteable(status); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); clusterName = new ClusterName(in); nodes = readNodesFrom(in); failures = in.readList(FailedNodeException::new); }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); clusterName.writeTo(out); writeNodesTo(out, nodes); out.writeList(failures); }