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

Name BulkItemResponse ctors (backport of #76439) #76460

Merged
merged 1 commit into from
Aug 12, 2021

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Aug 12, 2021

BulkItemResponse can contain either a success or failure. This
replaces the two constructors used to build either case with named
static methods. So instead of

return new BulkItemResponse(0, OpType.CREATE, createResponse);
return new BulkItemResponse(0, OpType.CREATE, failure);

you now use

return BulkItemResponse.success(0, OpType.CREATE, createResponse);
return BulkItemResponse.failure(0, OpType.CREATE, failure);

This makes it marginally easier to read code building these things - you
don't have to know the type of the parameter to know if its a failure
or success.

`BulkItemResponse` can contain either a success or failure. This
replaces the two constructors used to build either case with named
static methods. So instead of
```
return new BulkItemResponse(0, OpType.CREATE, createResponse);
return new BulkItemResponse(0, OpType.CREATE, failure);
```
you now use
```
return BulkItemResponse.success(0, OpType.CREATE, createResponse);
return BulkItemResponse.failure(0, OpType.CREATE, failure);
```

This makes it marginally easier to read code building these things - you
don't have to know the type of the parameter to know if its a failure
or success.
@nik9000 nik9000 added backport v7.15.0 auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Aug 12, 2021
@elasticsearchmachine elasticsearchmachine merged commit ecf5317 into elastic:7.x Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport v7.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants