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

Core: Replace Action class uses with GenericAction #31022

Closed
wants to merge 3 commits into from

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Jun 1, 2018

Since #30966, Action no longer has anything but a call to the
GenericAction super constructor. This commit replaces all uses of Action
with GenericAction, and removes Action. It also removes Request as a
generic type of GenericAction, as it was unused.

Since elastic#30966, Action no longer has anything but a call to the
GenericAction super constructor. This commit replaces all uses of Action
with GenericAction, and removes Action. It also removes Request as a
generic type of GenericAction, as it was unused.
@rjernst rjernst added :Core/Infra/Core Core issues without another label v7.0.0 >refactoring labels Jun 1, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Contributor

@bleskes bleskes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should rename GenericAction to Action now.

@@ -166,7 +166,7 @@ public void testReindexWithBadAuthentication() throws Exception {
}

/**
* Action filter that will reject the request if it isn't authenticated.
* GenericAction filter that will reject the request if it isn't authenticated.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional?

@@ -405,8 +405,8 @@ public void register(ActionHandler<?, ?> handler) {
}

public <Request extends ActionRequest, Response extends ActionResponse> void register(
GenericAction<Request, Response> action, Class<? extends TransportAction<Request, Response>> transportAction,
Class<?>... supportTransportActions) {
GenericAction<Response> action, Class<? extends TransportAction<Request, Response>> transportAction,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your indentation change here makes this harder to read.

@@ -31,7 +31,7 @@

/**
* Generic interface to group ActionRequest, which perform writes to a single document
* Action requests implementing this can be part of {@link org.elasticsearch.action.bulk.BulkRequest}
* GenericAction requests implementing this can be part of {@link org.elasticsearch.action.bulk.BulkRequest}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was right before?

@@ -369,7 +369,7 @@ public BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Null
} else if (SOURCE.match(currentFieldName, parser.getDeprecationHandler())) {
fetchSourceContext = FetchSourceContext.fromXContent(parser);
} else {
throw new IllegalArgumentException("Action/metadata line [" + line + "] contains an unknown parameter [" + currentFieldName + "]");
throw new IllegalArgumentException("GenericAction/metadata line [" + line + "] contains an unknown parameter [" + currentFieldName + "]");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was right before? Or, at least, this change doesn't make it more right.

@@ -48,7 +48,7 @@
public Wrapper(Logger logger, Settings settings, ThreadPool threadPool) {
this.logger = logger;
this.threadPool = threadPool;
// Should the action listener be threaded or not by default. Action listeners are automatically threaded for
// Should the action listener be threaded or not by default. GenericAction listeners are automatically threaded for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. I think they are still called action listeners.


/**
* This Action gets the stats for the watcher plugin
* This GenericAction gets the stats for the watcher plugin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old comment was fine.

@@ -49,7 +49,7 @@ private XContentBuilder serialiseCounts(DataCounts counts) throws IOException {
*
* @param jobId Job to update
* @param counts The counts
* @param listener Action response listener
* @param listener GenericAction response listener
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old comment was better.

@@ -328,7 +328,7 @@ public void authorize(Authentication authentication, String action, TransportReq
if (action.equals(TransportShardBulkAction.ACTION_NAME)) {
// is this is performing multiple actions on the index, then check each of those actions.
assert request instanceof BulkShardRequest
: "Action " + action + " requires " + BulkShardRequest.class + " but was " + request.getClass();
: "GenericAction " + action + " requires " + BulkShardRequest.class + " but was " + request.getClass();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old message was fine,.

@@ -523,7 +523,7 @@ static boolean checkSameUserPermissions(String action, TransportRequest request,
}

assert AuthenticateAction.NAME.equals(action) || HasPrivilegesAction.NAME.equals(action) || sameUsername == false
: "Action '" + action + "' should not be possible when sameUsername=" + sameUsername;
: "GenericAction '" + action + "' should not be possible when sameUsername=" + sameUsername;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old message was fine.

@@ -72,7 +72,7 @@ public void setup() {
@Override
protected <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends
ActionRequestBuilder<Request, Response>> void doExecute(
Action<Request, Response> action, Request request, ActionListener<Response> listener) {
GenericAction<Response> action, Request request, ActionListener<Response> listener) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is not longer consistent here.

@rjernst
Copy link
Member Author

rjernst commented Jun 18, 2018

@nik9000 I opened #31405 as an alternative to this PR, which does as you suggested (GenericAction -> Action). That also eliminates the IntelliJ wackiness that caused most of the doc changes you saw.

@nik9000
Copy link
Member

nik9000 commented Jun 18, 2018 via email

@rjernst rjernst closed this Jun 18, 2018
@rjernst rjernst deleted the deguice32 branch January 20, 2019 19:34
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >refactoring v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants