Skip to content

Commit 5e89cd9

Browse files
authored
Removal Streamable (#44647)
This commit ends the grand adventure that was the refactoring effort to migrate all usages of Streamable to Writeable. Closes #34389.
1 parent 7895dc9 commit 5e89cd9

File tree

8 files changed

+8
-78
lines changed

8 files changed

+8
-78
lines changed

modules/reindex/src/test/java/org/elasticsearch/index/reindex/RoundTripTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import static org.elasticsearch.common.unit.TimeValue.parseTimeValue;
4242

4343
/**
44-
* Round trip tests for all Streamable things declared in this plugin.
44+
* Round trip tests for all {@link Writeable} things declared in this plugin.
4545
*/
4646
public class RoundTripTests extends ESTestCase {
4747
public void testReindexRequest() throws IOException {

server/src/main/java/org/elasticsearch/common/io/stream/Streamable.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

server/src/main/java/org/elasticsearch/common/io/stream/Writeable.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
* Implementers can be written to a {@linkplain StreamOutput} and read from a {@linkplain StreamInput}. This allows them to be "thrown
2626
* across the wire" using Elasticsearch's internal protocol. If the implementer also implements equals and hashCode then a copy made by
2727
* serializing and deserializing must be equal and have the same hashCode. It isn't required that such a copy be entirely unchanged.
28-
* <p>
29-
* Prefer implementing this interface over implementing {@link Streamable} where possible. Lots of code depends on {@linkplain Streamable}
30-
* so this isn't always possible.
3128
*/
3229
public interface Writeable {
3330

server/src/main/java/org/elasticsearch/tasks/TaskInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* <p>
4848
* Tasks are used for communication with transport actions. As a result, they can contain callback
4949
* references as well as mutable state. That makes it impractical to send tasks over transport channels
50-
* and use in APIs. Instead, immutable and streamable TaskInfo objects are used to represent
50+
* and use in APIs. Instead, immutable and writeable TaskInfo objects are used to represent
5151
* snapshot information about currently running tasks.
5252
*/
5353
public final class TaskInfo implements Writeable, ToXContentFragment {

server/src/main/java/org/elasticsearch/transport/TransportMessage.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
package org.elasticsearch.transport;
2121

2222
import org.elasticsearch.common.io.stream.StreamInput;
23-
import org.elasticsearch.common.io.stream.Streamable;
2423
import org.elasticsearch.common.io.stream.Writeable;
2524
import org.elasticsearch.common.transport.TransportAddress;
2625

27-
import java.io.IOException;
28-
29-
public abstract class TransportMessage implements Streamable, Writeable {
26+
public abstract class TransportMessage implements Writeable {
3027

3128
private TransportAddress remoteAddress;
3229

@@ -41,18 +38,11 @@ public TransportAddress remoteAddress() {
4138
/**
4239
* Constructs a new empty transport message
4340
*/
44-
public TransportMessage() {
45-
}
41+
public TransportMessage() {}
4642

4743
/**
4844
* Constructs a new transport message with the data from the {@link StreamInput}. This is
4945
* currently a no-op
5046
*/
51-
public TransportMessage(StreamInput in) throws IOException {
52-
}
53-
54-
@Override
55-
public final void readFrom(StreamInput in) throws IOException {
56-
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
57-
}
47+
public TransportMessage(StreamInput in) {}
5848
}

server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponseTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import static org.hamcrest.CoreMatchers.containsString;
4949

5050
public class GetSnapshotsResponseTests extends ESTestCase {
51-
// We can not subclass AbstractStreamableXContentTestCase because it
51+
// We can not subclass AbstractSerializingTestCase because it
5252
// can only be used for instances with equals and hashCode
5353
// GetSnapshotResponse does not override equals and hashCode.
5454
// It does not override equals and hashCode, because it

server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected Predicate<String> getRandomFieldsExcludeFilter() {
7272
@Override
7373
protected void assertEqualInstances(UpdateSettingsRequest expectedInstance, UpdateSettingsRequest newInstance) {
7474
// here only the settings should be tested, as this test covers explicitly only the XContent parsing
75-
// the rest of the request fields are tested by the StreamableTests
75+
// the rest of the request fields are tested by the SerializingTests
7676
super.assertEqualInstances(new UpdateSettingsRequest(expectedInstance.settings()),
7777
new UpdateSettingsRequest(newInstance.settings()));
7878
}

server/src/test/java/org/elasticsearch/common/io/stream/BytesStreamsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public String getWriteableName() {
430430
}
431431
}
432432

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

0 commit comments

Comments
 (0)