Skip to content

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.


/**
* 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?

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.

/**
* 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?

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.

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.

* @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.

// 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,.


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.

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