Skip to content
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

Merged
merged 11 commits into from
Oct 26, 2018

Conversation

jaymode
Copy link
Member

@jaymode jaymode commented Oct 19, 2018

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 elastic#34389
@jaymode jaymode added >non-issue :Core/Infra/Core Core issues without another label v7.0.0 labels Oct 19, 2018
@jaymode jaymode requested a review from nik9000 October 19, 2018 19:39
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@nik9000 nik9000 left a 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@@ -39,6 +39,12 @@ public TransportAddress remoteAddress() {
return remoteAddress;
}

public TransportMessage() {
Copy link
Member

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.

Copy link
Member Author

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

@jaymode
Copy link
Member Author

jaymode commented Oct 22, 2018

@nik9000 thanks for the review; I've addressed your feedback.

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@jaymode jaymode merged commit a0279bc into elastic:master Oct 26, 2018
@jaymode jaymode deleted the response_writeable_reader branch October 26, 2018 15:21
jasontedor added a commit to martijnvg/elasticsearch that referenced this pull request Oct 26, 2018
* 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)
jaymode added a commit that referenced this pull request Oct 26, 2018
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
@talevy talevy added the v6.6.0 label Oct 26, 2018
kcm pushed a commit that referenced this pull request Oct 30, 2018
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants