Skip to content

Commit

Permalink
Removal Streamable (#44647) (#44655)
Browse files Browse the repository at this point in the history
This commit ends the grand adventure that was the
refactoring effort to migrate all usages of
Streamable to Writeable.

Closes #34389.
  • Loading branch information
talevy authored Jul 21, 2019
1 parent cdd06d4 commit 1a9cfe9
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import static org.elasticsearch.common.unit.TimeValue.parseTimeValue;

/**
* Round trip tests for all Streamable things declared in this plugin.
* Round trip tests for all {@link Writeable} things declared in this plugin.
*/
public class RoundTripTests extends ESTestCase {
public void testReindexRequest() throws IOException {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
* Implementers can be written to a {@linkplain StreamOutput} and read from a {@linkplain StreamInput}. This allows them to be "thrown
* across the wire" using Elasticsearch's internal protocol. If the implementer also implements equals and hashCode then a copy made by
* serializing and deserializing must be equal and have the same hashCode. It isn't required that such a copy be entirely unchanged.
* <p>
* Prefer implementing this interface over implementing {@link Streamable} where possible. Lots of code depends on {@linkplain Streamable}
* so this isn't always possible.
*/
public interface Writeable {

Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/org/elasticsearch/tasks/TaskInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* <p>
* Tasks are used for communication with transport actions. As a result, they can contain callback
* references as well as mutable state. That makes it impractical to send tasks over transport channels
* and use in APIs. Instead, immutable and streamable TaskInfo objects are used to represent
* and use in APIs. Instead, immutable and writeable TaskInfo objects are used to represent
* snapshot information about currently running tasks.
*/
public final class TaskInfo implements Writeable, ToXContentFragment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
package org.elasticsearch.transport;

import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.transport.TransportAddress;

import java.io.IOException;

public abstract class TransportMessage implements Streamable, Writeable {
public abstract class TransportMessage implements Writeable {

private TransportAddress remoteAddress;

Expand All @@ -41,18 +38,11 @@ public TransportAddress remoteAddress() {
/**
* Constructs a new empty transport message
*/
public TransportMessage() {
}
public TransportMessage() {}

/**
* Constructs a new transport message with the data from the {@link StreamInput}. This is
* currently a no-op
*/
public TransportMessage(StreamInput in) throws IOException {
}

@Override
public final void readFrom(StreamInput in) throws IOException {
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
}
public TransportMessage(StreamInput in) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected Predicate<String> getRandomFieldsExcludeFilter() {
@Override
protected void assertEqualInstances(UpdateSettingsRequest expectedInstance, UpdateSettingsRequest newInstance) {
// here only the settings should be tested, as this test covers explicitly only the XContent parsing
// the rest of the request fields are tested by the StreamableTests
// the rest of the request fields are tested by the SerializingTests
super.assertEqualInstances(new UpdateSettingsRequest(expectedInstance.settings()),
new UpdateSettingsRequest(newInstance.settings()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public String getWriteableName() {
}
}

public void testWriteStreamableList() throws IOException {
public void testWriteWriteableList() throws IOException {
final int size = randomIntBetween(0, 5);
final List<TestWriteable> expected = new ArrayList<>(size);

Expand Down

0 comments on commit 1a9cfe9

Please sign in to comment.