-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Rename methods in ChunkedToXContentHelper to be clearer #119342
Conversation
Pinging @elastic/es-core-infra (Team: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.
Looks good, just left a couple questions
* @return Singleton iterator for the given item. | ||
*/ | ||
public static Iterator<ToXContent> chunk(ToXContent item) { | ||
return Iterators.single(item); |
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.
Nit: should you remove singleChunck? It looks like a leftover
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.
It's currently used by Serverless, tidying up Serverless uses I'll do separately.
@@ -247,7 +247,7 @@ public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params | |||
ChunkedToXContentHelper.field(PARTIAL_FIELD.getPreferredName(), getClusterStateCount(Cluster.Status.PARTIAL)), | |||
ChunkedToXContentHelper.field(FAILED_FIELD.getPreferredName(), getClusterStateCount(Cluster.Status.FAILED)), | |||
// each Cluster object defines its own field object name | |||
ChunkedToXContentHelper.xContentFragmentValuesMapCreateOwnName("details", clusterInfo), | |||
ChunkedToXContentHelper.object("details", clusterInfo.values().iterator()), |
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.
Is this equivalent? The implementations are surely different, but maybe the end result is the same. Just checking.
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.
It is equivalent - the chunk counts dont change, and the tests still all pass (notice xContentFragmentValuesMapCreateOwnName
is just calling getValue.toXContent
, ignoring the key entirely)
Rename/consolidate methods in
ChunkedToXContentHelper