Elasticsearch: Rename TransportXXXAction classes to XXXTransportAction

Created on 2 Aug 2016  ยท  11Comments  ยท  Source: elastic/elasticsearch

Just a proposal here. Feel free to close if non sense.

We have today the following classes for actions:

  • XXXAction
  • XXXRequest
  • XXXRequestBuilder
  • XXXResponse
  • TransportXXXAction

When you try to reduce the number of packages, let say for a plugin for example, you might want to put all your actions within the same package. For example, see the reindex plugin:

It has (skipping non related classes):

โ”œโ”€โ”€ DeleteByQueryAction.java
โ”œโ”€โ”€ DeleteByQueryRequest.java
โ”œโ”€โ”€ DeleteByQueryRequestBuilder.java
โ”œโ”€โ”€ ReindexAction.java
โ”œโ”€โ”€ ReindexRequest.java
โ”œโ”€โ”€ ReindexRequestBuilder.java
โ”œโ”€โ”€ RestDeleteByQueryAction.java
โ”œโ”€โ”€ RestReindexAction.java
โ”œโ”€โ”€ RestRethrottleAction.java
โ”œโ”€โ”€ RestUpdateByQueryAction.java
โ”œโ”€โ”€ RethrottleAction.java
โ”œโ”€โ”€ RethrottleRequest.java
โ”œโ”€โ”€ RethrottleRequestBuilder.java
โ”œโ”€โ”€ TransportDeleteByQueryAction.java
โ”œโ”€โ”€ TransportReindexAction.java
โ”œโ”€โ”€ TransportRethrottleAction.java
โ”œโ”€โ”€ TransportUpdateByQueryAction.java
โ”œโ”€โ”€ UpdateByQueryAction.java
โ”œโ”€โ”€ UpdateByQueryRequest.java
โ”œโ”€โ”€ UpdateByQueryRequestBuilder.java

As a developer, I have to scroll up and down every time when I want to open the TransportAction associated with a given Action.

The proposal is to rename TransportXXXAction to XXXTransportAction so all those related classes will be grouped all together.

Thoughts?

Depending on the result of this discussion, we can also imagine a follow up for RestXXXAction which could become XXXRestAction.
The previous example would become:

โ”œโ”€โ”€ DeleteByQueryAction.java
โ”œโ”€โ”€ DeleteByQueryRequest.java
โ”œโ”€โ”€ DeleteByQueryRequestBuilder.java
โ”œโ”€โ”€ DeleteByQueryRestAction.java
โ”œโ”€โ”€ DeleteByQueryTransportAction.java
โ”œโ”€โ”€ ReindexAction.java
โ”œโ”€โ”€ ReindexRequest.java
โ”œโ”€โ”€ ReindexRequestBuilder.java
โ”œโ”€โ”€ ReindexRestAction.java
โ”œโ”€โ”€ ReindexTransportAction.java
โ”œโ”€โ”€ RethrottleAction.java
โ”œโ”€โ”€ RethrottleRequest.java
โ”œโ”€โ”€ RethrottleRequestBuilder.java
โ”œโ”€โ”€ RethrottleRestAction.java
โ”œโ”€โ”€ RethrottleTransportAction.java
โ”œโ”€โ”€ UpdateByQueryAction.java
โ”œโ”€โ”€ UpdateByQueryRequest.java
โ”œโ”€โ”€ UpdateByQueryRequestBuilder.java
โ”œโ”€โ”€ UpdateByQueryRestAction.java
โ”œโ”€โ”€ UpdateByQueryTransportAction.java
>non-issue discuss

Most helpful comment

I've always referred to these classes in my head as the "transport actions" as opposed to the "rest actions". The latter is the code executed on the rest layer which then delegates to the former, which is the corresponding action that executes on the transport layer. That's why I don't read "transport" as a verb and I would be in favour of the proposed rename.

And the fact that it would help keeping classes for the same api closer rather than far apart is a plus too.

All 11 comments

+1 on doing both. It'd make reading reindex easier and it only has four
actions.

On Aug 2, 2016 5:48 AM, "David Pilato" [email protected] wrote:

Just a proposal here. Feel free to close if non sense.

We have today the following classes for actions:

  • XXXAction
  • XXXRequest
  • XXXRequestBuilder
  • XXXResponse
  • TransportXXXAction

When you try to reduce the number of packages, let say for a plugin for
example, you might want to put all your actions within the same package.
For example, see the reindex plugin
https://github.com/elastic/elasticsearch/tree/master/modules/reindex/src/main/java/org/elasticsearch/index/reindex
:

It has (skipping non related classes):

โ”œโ”€โ”€ DeleteByQueryAction.java
โ”œโ”€โ”€ DeleteByQueryRequest.java
โ”œโ”€โ”€ DeleteByQueryRequestBuilder.java
โ”œโ”€โ”€ ReindexAction.java
โ”œโ”€โ”€ ReindexRequest.java
โ”œโ”€โ”€ ReindexRequestBuilder.java
โ”œโ”€โ”€ RestDeleteByQueryAction.java
โ”œโ”€โ”€ RestReindexAction.java
โ”œโ”€โ”€ RestRethrottleAction.java
โ”œโ”€โ”€ RestUpdateByQueryAction.java
โ”œโ”€โ”€ RethrottleAction.java
โ”œโ”€โ”€ RethrottleRequest.java
โ”œโ”€โ”€ RethrottleRequestBuilder.java
โ”œโ”€โ”€ TransportDeleteByQueryAction.java
โ”œโ”€โ”€ TransportReindexAction.java
โ”œโ”€โ”€ TransportRethrottleAction.java
โ”œโ”€โ”€ TransportUpdateByQueryAction.java
โ”œโ”€โ”€ UpdateByQueryAction.java
โ”œโ”€โ”€ UpdateByQueryRequest.java
โ”œโ”€โ”€ UpdateByQueryRequestBuilder.java

As a developer, I have to scroll up and down every time when I want to
open the TransportAction associated with a given Action.

The proposal is to rename TransportXXXAction to XXXTransportAction so all
those related classes will be grouped all together.

Thoughts?

Depending on the result of this discussion, we can also imagine a follow
up for RestXXXAction which could become XXXRestAction.
The previous example would become:

โ”œโ”€โ”€ DeleteByQueryAction.java
โ”œโ”€โ”€ DeleteByQueryRequest.java
โ”œโ”€โ”€ DeleteByQueryRequestBuilder.java
โ”œโ”€โ”€ DeleteByQueryRestAction.java
โ”œโ”€โ”€ DeleteByQueryTransportAction.java
โ”œโ”€โ”€ ReindexAction.java
โ”œโ”€โ”€ ReindexRequest.java
โ”œโ”€โ”€ ReindexRequestBuilder.java
โ”œโ”€โ”€ ReindexRestAction.java
โ”œโ”€โ”€ ReindexTransportAction.java
โ”œโ”€โ”€ RethrottleAction.java
โ”œโ”€โ”€ RethrottleRequest.java
โ”œโ”€โ”€ RethrottleRequestBuilder.java
โ”œโ”€โ”€ RethrottleRestAction.java
โ”œโ”€โ”€ RethrottleTransportAction.java
โ”œโ”€โ”€ UpdateByQueryAction.java
โ”œโ”€โ”€ UpdateByQueryRequest.java
โ”œโ”€โ”€ UpdateByQueryRequestBuilder.java
โ”œโ”€โ”€ UpdateByQueryRestAction.java
โ”œโ”€โ”€ UpdateByQueryTransportAction.java

โ€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/elastic/elasticsearch/issues/19737, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AANLogFbAgj3pe2X-VUY-76QCk74r6QCks5qbxJqgaJpZM4JabZN
.

+1

Conceptually, the class name TransportReindexAction communicates _exactly_ what the class is doing, it transports the reindex action. However, the name ReindexTransportAction does not communicate this. For this reason, I prefer the current naming scheme and I'm opposed to this change.

it transports the reindex action

I think of it as _implementing_ the reindex action rather than _transporting_ it.

I think of it as implementing the reindex action rather than transporting it.

That was my initial thought as well. If it is, we should may be rename with something more obvious like ReindexActionImplementation (just a proposal here)?

I think of it as implementing the reindex action rather than transporting it.

But that's what I mean? It coordinates and executes the entire action. Look at something like TransportBroadcastByNodeAction. At the start of the request, it transports a node-level request to each node responsible for executing node-level operations. Each node receives these requests, executes the operations, and transports the result back to the coordinating node. The coordinating node then collects these results, and notifies the action listener.

It coordinates and executes the entire action.

I've always thought of the coordination and execution portions as "more than" transporting the action though.

I've always referred to these classes in my head as the "transport actions" as opposed to the "rest actions". The latter is the code executed on the rest layer which then delegates to the former, which is the corresponding action that executes on the transport layer. That's why I don't read "transport" as a verb and I would be in favour of the proposed rename.

And the fact that it would help keeping classes for the same api closer rather than far apart is a plus too.

Do we have any veto on this?
It's "just" about renaming. Should I try to get that before 5.0.0 Beta or GA? Or do we prefer doing this for 6.0?

@clintongormley @s1monw what do you think?

Should I close it or work on a PR against 6.0 branch?

Given that we didn't reach consensus on this, I don't think we should do it. Closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpountz picture jpountz  ยท  3Comments

martijnvg picture martijnvg  ยท  3Comments

dadoonet picture dadoonet  ยท  3Comments

abtpst picture abtpst  ยท  3Comments

Praveen82 picture Praveen82  ยท  3Comments