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
Refactored TransportSingleCustomOperationAction, subclasses and requests #7214
Conversation
… and requests TransportSingleCustomOperationAction is subclassed by two similar, yet different transport action: TransportAnalyzeAction and TransportGetFieldMappingsAction. Made their difference and similarities more explicit by sharing common code and moving specific code to subclasses: - moved index field to the parent SingleCustomOperationAction class - moved the common check blocks code to the parent transport action class - moved the main transport handler to the TransportAnalyzeAction subclass as it is only used to receive external requests through clients. In the case of the TransportGetFieldMappingsIndexAction instead, the action is internal and executed only locally as part of the user facing TransportGetFieldMappingsAction. The corresponding request gets sent over the transport though as part of the related shard request - removed the get field mappings index action from the action names mapping as it is not a transport handler anymore. It was before although never used.
@@ -83,12 +111,18 @@ public void beforeLocalFork() { | |||
public void readFrom(StreamInput in) throws IOException { | |||
super.readFrom(in); | |||
preferLocal = in.readBoolean(); | |||
if (in.getVersion().onOrAfter(Version.V_1_4_0)) { | |||
index = in.readOptionalString(); | |||
} |
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.
Since the index on not optional for the get field mappings action, maybe there should rather be 2 overridable protected methods readIndex
and writeIndex
? This way we wouldn't even need the version checks?
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.
makes sense, the reason why I didn't do it is that on the long run bw comp checks will go away and everything would be simpler if the index is serialized by the class that holds it. On the other hand the additional methods you suggest don't complicate things that much.
Updated according to review's comment |
LGTM |
… and requests TransportSingleCustomOperationAction is subclassed by two similar, yet different transport action: TransportAnalyzeAction and TransportGetFieldMappingsAction. Made their difference and similarities more explicit by sharing common code and moving specific code to subclasses: - moved index field to the parent SingleCustomOperationAction class - moved the common check blocks code to the parent transport action class - moved the main transport handler to the TransportAnalyzeAction subclass as it is only used to receive external requests through clients. In the case of the TransportGetFieldMappingsIndexAction instead, the action is internal and executed only locally as part of the user facing TransportGetFieldMappingsAction. The corresponding request gets sent over the transport though as part of the related shard request - removed the get field mappings index action from the action names mapping as it is not a transport handler anymore. It was before although never used. Closes #7214
… and requests TransportSingleCustomOperationAction is subclassed by two similar, yet different transport action: TransportAnalyzeAction and TransportGetFieldMappingsAction. Made their difference and similarities more explicit by sharing common code and moving specific code to subclasses: - moved index field to the parent SingleCustomOperationAction class - moved the common check blocks code to the parent transport action class - moved the main transport handler to the TransportAnalyzeAction subclass as it is only used to receive external requests through clients. In the case of the TransportGetFieldMappingsIndexAction instead, the action is internal and executed only locally as part of the user facing TransportGetFieldMappingsAction. The corresponding request gets sent over the transport though as part of the related shard request - removed the get field mappings index action from the action names mapping as it is not a transport handler anymore. It was before although never used. Closes #7214
TransportSingleCustomOperationAction
is subclassed by two similar, yet different transport actions:TransportAnalyzeAction
andTransportGetFieldMappingsIndexAction
. Made their difference and similarities more explicit by sharing common code and moving specific code to subclasses:SingleCustomOperationAction
classTransportAnalyzeAction
subclass as it is only used to receive external requests through clients. In the case of theTransportGetFieldMappingsIndexAction
instead, the action is internal and executed only locally as part of the user facingTransportGetFieldMappingsAction
. The corresponding request gets sent over the transport though as part of the related shard request