-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Dry up AcknowledgedResponse Handling #63335
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
Dry up AcknowledgedResponse Handling #63335
Conversation
1. `AcknowledgedResponse` should really be two singletons to make things clearer and save some objects and code size. 2. We were duplicating reading this type over and over in a bunch of transport master node actions so I dried that up
Pinging @elastic/es-core-infra (:Core/Infra/Core) |
Jenkins run elasticsearch-ci/packaging-sample-windows |
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.
LGTM
|
||
import java.io.IOException; | ||
|
||
public abstract class AcknowledgedTransportMasterNodeAction<Request extends MasterNodeRequest<Request>> |
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.
short javadoc?
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.
added :)
Thanks Ryan! |
1. It is confusing and unnecessary to handle response deserialization via inheritance and request deserialization via composition. Consistently using composition saves hundreds of lines of code and as a matter of fact also removes some indirection in transport master node action since we pass a reader down to the response handling anyway. 2. Defining `executor` via inheritance but then assuming the return of the method is a constant is confusing and again not in line with how we handle the `executor` definition for other transport actions so this was simplified away as well. Somewhat relates to the dry-up in elastic#63335
1. It is confusing and unnecessary to handle response deserialization via inheritance and request deserialization via composition. Consistently using composition saves hundreds of lines of code and as a matter of fact also removes some indirection in transport master node action since we pass a reader down to the response handling anyway. 2. Defining `executor` via inheritance but then assuming the return of the method is a constant is confusing and again not in line with how we handle the `executor` definition for other transport actions so this was simplified away as well. Somewhat relates to the dry-up in #63335
These intermediary response types don't contain any information outside of what the shard acknowledged and acknowledged responses contain so this PR removes them. Also, it adds three constants for the three possible states of `ShardsAcknowledgedResponse`. Follow up to elastic#63335
1. `AcknowledgedResponse` should really be two singletons to make things clearer and save some objects and code size. 2. We were duplicating reading this type over and over in a bunch of transport master node actions so I dried that up
1. It is confusing and unnecessary to handle response deserialization via inheritance and request deserialization via composition. Consistently using composition saves hundreds of lines of code and as a matter of fact also removes some indirection in transport master node action since we pass a reader down to the response handling anyway. 2. Defining `executor` via inheritance but then assuming the return of the method is a constant is confusing and again not in line with how we handle the `executor` definition for other transport actions so this was simplified away as well. Somewhat relates to the dry-up in elastic#63335
1. It is confusing and unnecessary to handle response deserialization via inheritance and request deserialization via composition. Consistently using composition saves hundreds of lines of code and as a matter of fact also removes some indirection in transport master node action since we pass a reader down to the response handling anyway. 2. Defining `executor` via inheritance but then assuming the return of the method is a constant is confusing and again not in line with how we handle the `executor` definition for other transport actions so this was simplified away as well. Somewhat relates to the dry-up in #63335
These intermediary response types don't contain any information outside of what the shard acknowledged and acknowledged responses contain so this PR removes them. Also, it adds three constants for the three possible states of `ShardsAcknowledgedResponse`. Follow up to #63335
These intermediary response types don't contain any information outside of what the shard acknowledged and acknowledged responses contain so this PR removes them. Also, it adds three constants for the three possible states of `ShardsAcknowledgedResponse`. Follow up to #63335
Motivated by the fact that we keep adding more and more master node actions that return an ack response:
AcknowledgedResponse
should really be two singletons to make things clearer and save some objects and code size.