Skip to content

Commit 966fdfd

Browse files
committed
Changed es version from string to class Version
1 parent 22f99e8 commit 966fdfd

File tree

1 file changed

+7
-6
lines changed
  • src/main/java/org/elasticsearch/action/admin/cluster/node/info

1 file changed

+7
-6
lines changed

src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.elasticsearch.action.admin.cluster.node.info;
2121

2222
import com.google.common.collect.ImmutableMap;
23+
import org.elasticsearch.Version;
2324
import org.elasticsearch.action.support.nodes.NodeOperationResponse;
2425
import org.elasticsearch.cluster.node.DiscoveryNode;
2526
import org.elasticsearch.common.Nullable;
@@ -49,7 +50,7 @@ public class NodeInfo extends NodeOperationResponse {
4950
@Nullable
5051
private String hostname;
5152

52-
private String version;
53+
private Version version;
5354

5455
@Nullable
5556
private Settings settings;
@@ -78,7 +79,7 @@ public class NodeInfo extends NodeOperationResponse {
7879
NodeInfo() {
7980
}
8081

81-
public NodeInfo(@Nullable String hostname, String version, DiscoveryNode node, @Nullable ImmutableMap<String, String> serviceAttributes, @Nullable Settings settings,
82+
public NodeInfo(@Nullable String hostname, Version version, DiscoveryNode node, @Nullable ImmutableMap<String, String> serviceAttributes, @Nullable Settings settings,
8283
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable NetworkInfo network,
8384
@Nullable TransportInfo transport, @Nullable HttpInfo http) {
8485
super(node);
@@ -114,14 +115,14 @@ public String getHostname() {
114115
/**
115116
* The current ES version
116117
*/
117-
public String version() {
118+
public Version version() {
118119
return version;
119120
}
120121

121122
/**
122123
* The current ES version
123124
*/
124-
public String getVersion() {
125+
public Version getVersion() {
125126
return version();
126127
}
127128

@@ -263,7 +264,7 @@ public void readFrom(StreamInput in) throws IOException {
263264
if (in.readBoolean()) {
264265
hostname = in.readUTF();
265266
}
266-
version = in.readOptionalString();
267+
version = Version.readVersion(in);
267268
if (in.readBoolean()) {
268269
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
269270
int size = in.readVInt();
@@ -307,7 +308,7 @@ public void writeTo(StreamOutput out) throws IOException {
307308
out.writeBoolean(true);
308309
out.writeUTF(hostname);
309310
}
310-
out.writeOptionalString(version);
311+
out.writeVInt(version.id);
311312
if (serviceAttributes() == null) {
312313
out.writeBoolean(false);
313314
} else {

0 commit comments

Comments
 (0)