-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Responses can use Writeable.Reader interface #34655
Conversation
In order to remove Streamable from the codebase, Response objects need to be read using the Writeable.Reader interface which this change enables. This change enables the use of Writeable.Reader by adding the `Action#getResponseReader` method. The default implementation simply uses the existing `newResponse` method and the readFrom method. As responses are migrated to the Writeable.Reader interface, Action classes can be updated to throw an UnsupportedOperationException when `newResponse` is called and override the `getResponseReader` method. Relates elastic#34389
Pinging @elastic/es-core-infra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I left a few small things. I think this is wonderful!
private Map<String, AliasFilter> indicesAndFilters; | ||
|
||
public ClusterSearchShardsResponse() { | ||
private final ClusterSearchShardsGroup[] groups; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
...src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/discovery/zen/NodesFaultDetection.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/discovery/zen/MasterFaultDetection.java
Outdated
Show resolved
Hide resolved
@@ -39,6 +39,12 @@ public TransportAddress remoteAddress() { | |||
return remoteAddress; | |||
} | |||
|
|||
public TransportMessage() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. If it doesn't need StreamInput
to be read, maybe don't define either ctor and just use the empty ctor that comes for free. But I see the point of defining this to sort of tell people that it is useful and that subclasses are going to have it. Either way I think some javadoc would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with adding the constructors due to a comment from @tvernum on another PR #34572 (comment). I see the point of having the constructor with the streaminput; I'll add the javadocs
@nik9000 thanks for the review; I've addressed your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
* master: Introduce cross-cluster replication API docs (elastic#34726) Responses can use Writeable.Reader interface (elastic#34655) SQL: Provide null-safe scripts for Not and Neg (elastic#34877) Fix put/resume follow request parsing (elastic#34913) Fix line length for org.elasticsearch.common.* files (elastic#34888) [ML] Extract common native process base class (elastic#34856) Refactor children aggregator into a generic ParentJoinAggregator (elastic#34845) [Style] Fix line lengths in action.admin.indices (elastic#34890) HLRC - add support for source exists API (elastic#34519)
In order to remove Streamable from the codebase, Response objects need to be read using the Writeable.Reader interface which this change enables. This change enables the use of Writeable.Reader by adding the `Action#getResponseReader` method. The default implementation simply uses the existing `newResponse` method and the readFrom method. As responses are migrated to the Writeable.Reader interface, Action classes can be updated to throw an UnsupportedOperationException when `newResponse` is called and override the `getResponseReader` method. Relates #34389
In order to remove Streamable from the codebase, Response objects need to be read using the Writeable.Reader interface which this change enables. This change enables the use of Writeable.Reader by adding the `Action#getResponseReader` method. The default implementation simply uses the existing `newResponse` method and the readFrom method. As responses are migrated to the Writeable.Reader interface, Action classes can be updated to throw an UnsupportedOperationException when `newResponse` is called and override the `getResponseReader` method. Relates #34389
In order to remove Streamable from the codebase, Response objects need
to be read using the Writeable.Reader interface which this change
enables. This change enables the use of Writeable.Reader by adding the
Action#getResponseReader
method. The default implementation simplyuses the existing
newResponse
method and the readFrom method. Asresponses are migrated to the Writeable.Reader interface, Action
classes can be updated to throw an UnsupportedOperationException when
newResponse
is called and override thegetResponseReader
method.Relates #34389