mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
Remove readFrom from xpack
Writeable#readFrom has become a method you just implement because the interface requires it but the prefered way to actually do the reading is a ctor that takes a StreamReader. readFrom just delegates to the ctor. This removes readFrom entirely because it is not needed anymore and is going away in core. Relates to https://github.com/elastic/elasticsearch/issues/17085 Original commit: elastic/x-pack-elasticsearch@dd74db5ded
This commit is contained in:
parent
5c9d96211f
commit
de6d3e1a72
@ -24,6 +24,9 @@ public class MonitoringBulkDoc extends MonitoringDoc {
|
||||
super(monitoringId, monitoringVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public MonitoringBulkDoc(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
index = in.readOptionalString();
|
||||
@ -32,6 +35,15 @@ public class MonitoringBulkDoc extends MonitoringDoc {
|
||||
source = in.readBytesReference();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeOptionalString(index);
|
||||
out.writeOptionalString(type);
|
||||
out.writeOptionalString(id);
|
||||
out.writeBytesReference(source);
|
||||
}
|
||||
|
||||
public String getIndex() {
|
||||
return index;
|
||||
}
|
||||
@ -63,18 +75,4 @@ public class MonitoringBulkDoc extends MonitoringDoc {
|
||||
public void setSource(BytesReference source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeOptionalString(index);
|
||||
out.writeOptionalString(type);
|
||||
out.writeOptionalString(id);
|
||||
out.writeBytesReference(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonitoringBulkDoc readFrom(StreamInput in) throws IOException {
|
||||
return new MonitoringBulkDoc(in);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||
this.monitoringVersion = monitoringVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public MonitoringDoc(StreamInput in) throws IOException {
|
||||
this(in.readOptionalString(), in.readOptionalString());
|
||||
clusterUUID = in.readOptionalString();
|
||||
@ -41,6 +44,15 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||
sourceNode = in.readOptionalWriteable(Node::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeOptionalString(getMonitoringId());
|
||||
out.writeOptionalString(getMonitoringVersion());
|
||||
out.writeOptionalString(getClusterUUID());
|
||||
out.writeVLong(getTimestamp());
|
||||
out.writeOptionalWriteable(getSourceNode());
|
||||
}
|
||||
|
||||
public String getClusterUUID() {
|
||||
return clusterUUID;
|
||||
}
|
||||
@ -86,20 +98,6 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||
"]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeOptionalString(getMonitoringId());
|
||||
out.writeOptionalString(getMonitoringVersion());
|
||||
out.writeOptionalString(getClusterUUID());
|
||||
out.writeVLong(getTimestamp());
|
||||
out.writeOptionalWriteable(getSourceNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonitoringDoc readFrom(StreamInput in) throws IOException {
|
||||
return new MonitoringDoc(in);
|
||||
}
|
||||
|
||||
public static class Node implements Writeable<Node>, ToXContent {
|
||||
|
||||
private String uuid;
|
||||
@ -123,6 +121,9 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public Node(StreamInput in) throws IOException {
|
||||
uuid = in.readOptionalString();
|
||||
host = in.readOptionalString();
|
||||
@ -136,6 +137,25 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeOptionalString(uuid);
|
||||
out.writeOptionalString(host);
|
||||
out.writeOptionalString(transportAddress);
|
||||
out.writeOptionalString(ip);
|
||||
out.writeOptionalString(name);
|
||||
if (attributes != null) {
|
||||
out.writeVInt(attributes.size());
|
||||
for (Map.Entry<String, String> entry : attributes.entrySet()) {
|
||||
out.writeString(entry.getKey());
|
||||
out.writeString(entry.getValue());
|
||||
}
|
||||
} else {
|
||||
out.writeVInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
@ -177,29 +197,6 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
|
||||
return builder.endObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeOptionalString(uuid);
|
||||
out.writeOptionalString(host);
|
||||
out.writeOptionalString(transportAddress);
|
||||
out.writeOptionalString(ip);
|
||||
out.writeOptionalString(name);
|
||||
if (attributes != null) {
|
||||
out.writeVInt(attributes.size());
|
||||
for (Map.Entry<String, String> entry : attributes.entrySet()) {
|
||||
out.writeString(entry.getKey());
|
||||
out.writeString(entry.getValue());
|
||||
}
|
||||
} else {
|
||||
out.writeVInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node readFrom(StreamInput in) throws IOException {
|
||||
return new Node(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user