Removed redundant version checks in transport serialization (#4731 leftover)

This commit is contained in:
Luca Cavanna 2014-01-24 16:12:25 +01:00
parent 107a242d38
commit 61158387fe
9 changed files with 12 additions and 38 deletions

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.cluster.reroute; package org.elasticsearch.action.admin.cluster.reroute;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
@ -54,13 +53,13 @@ public class ClusterRerouteResponse extends AcknowledgedResponse {
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
state = ClusterState.Builder.readFrom(in, null); state = ClusterState.Builder.readFrom(in, null);
readAcknowledged(in, Version.V_0_90_6); readAcknowledged(in);
} }
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out); super.writeTo(out);
ClusterState.Builder.writeTo(state, out); ClusterState.Builder.writeTo(state, out);
writeAcknowledged(out, Version.V_0_90_6); writeAcknowledged(out);
} }
} }

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.cluster.settings; package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -52,7 +51,7 @@ public class ClusterUpdateSettingsResponse extends AcknowledgedResponse {
super.readFrom(in); super.readFrom(in);
transientSettings = ImmutableSettings.readSettingsFromStream(in); transientSettings = ImmutableSettings.readSettingsFromStream(in);
persistentSettings = ImmutableSettings.readSettingsFromStream(in); persistentSettings = ImmutableSettings.readSettingsFromStream(in);
readAcknowledged(in, Version.V_0_90_6); readAcknowledged(in);
} }
public Settings getTransientSettings() { public Settings getTransientSettings() {
@ -68,6 +67,6 @@ public class ClusterUpdateSettingsResponse extends AcknowledgedResponse {
super.writeTo(out); super.writeTo(out);
ImmutableSettings.writeSettingsToStream(transientSettings, out); ImmutableSettings.writeSettingsToStream(transientSettings, out);
ImmutableSettings.writeSettingsToStream(persistentSettings, out); ImmutableSettings.writeSettingsToStream(persistentSettings, out);
writeAcknowledged(out, Version.V_0_90_6); writeAcknowledged(out);
} }
} }

View File

@ -40,12 +40,12 @@ public class CreateIndexResponse extends AcknowledgedResponse {
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
readAcknowledged(in, null); readAcknowledged(in);
} }
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out); super.writeTo(out);
writeAcknowledged(out, null); writeAcknowledged(out);
} }
} }

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.indices.mapping.delete; package org.elasticsearch.action.admin.indices.mapping.delete;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -42,12 +41,12 @@ public class DeleteMappingResponse extends AcknowledgedResponse {
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
readAcknowledged(in, Version.V_0_90_6); readAcknowledged(in);
} }
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out); super.writeTo(out);
writeAcknowledged(out, Version.V_0_90_6); writeAcknowledged(out);
} }
} }

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.indices.settings.put; package org.elasticsearch.action.admin.indices.settings.put;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -41,12 +40,12 @@ public class UpdateSettingsResponse extends AcknowledgedResponse {
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
readAcknowledged(in, Version.V_0_90_6); readAcknowledged(in);
} }
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out); super.writeTo(out);
writeAcknowledged(out, Version.V_0_90_6); writeAcknowledged(out);
} }
} }

View File

@ -18,7 +18,6 @@
*/ */
package org.elasticsearch.action.admin.indices.warmer.delete; package org.elasticsearch.action.admin.indices.warmer.delete;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.action.support.master.AcknowledgedRequest;

View File

@ -18,7 +18,6 @@
*/ */
package org.elasticsearch.action.support.master; package org.elasticsearch.action.support.master;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -53,31 +52,13 @@ public abstract class AcknowledgedResponse extends ActionResponse {
* Reads the timeout value * Reads the timeout value
*/ */
protected void readAcknowledged(StreamInput in) throws IOException { protected void readAcknowledged(StreamInput in) throws IOException {
readAcknowledged(in, null); acknowledged = in.readBoolean();
}
/**
* Reads the timeout value if on or after the specified min version or if the version is <code>null</code>.
*/
protected void readAcknowledged(StreamInput in, Version minVersion) throws IOException {
if (minVersion == null || in.getVersion().onOrAfter(minVersion)) {
acknowledged = in.readBoolean();
}
} }
/** /**
* Writes the timeout value * Writes the timeout value
*/ */
protected void writeAcknowledged(StreamOutput out) throws IOException { protected void writeAcknowledged(StreamOutput out) throws IOException {
writeAcknowledged(out, null); out.writeBoolean(acknowledged);
}
/**
* Writes the timeout value if on or after the specified min version or if the version is <code>null</code>.
*/
protected void writeAcknowledged(StreamOutput out, Version minVersion) throws IOException {
if (minVersion == null || out.getVersion().onOrAfter(minVersion)) {
out.writeBoolean(acknowledged);
}
} }
} }

View File

@ -20,7 +20,6 @@
package org.elasticsearch.cluster.metadata; package org.elasticsearch.cluster.metadata;
import org.elasticsearch.ElasticsearchIllegalStateException; import org.elasticsearch.ElasticsearchIllegalStateException;
import org.elasticsearch.Version;
import org.elasticsearch.action.TimestampParsingException; import org.elasticsearch.action.TimestampParsingException;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;

View File

@ -26,7 +26,6 @@ import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.*; import com.google.common.collect.*;
import org.elasticsearch.ElasticsearchIllegalArgumentException; import org.elasticsearch.ElasticsearchIllegalArgumentException;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlock;
import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.block.ClusterBlockLevel;