-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Conversation
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.
Pinging @elastic/es-core-infra |
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.
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.
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. |
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.
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, |
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.
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} |
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.
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 + "]"); |
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.
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 |
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.
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 |
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.
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 |
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.
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(); |
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.
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; |
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.
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) { |
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.
The indentation is not longer consistent here.
Thanks! I like that one a lot!
…On Mon, Jun 18, 2018 at 2:23 PM Ryan Ernst ***@***.***> wrote:
@nik9000 <https://github.com/nik9000> I opened #31405
<#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.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#31022 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANLolHyj9NkecUHoklPPKskWGuVJh4yks5t9_AngaJpZM4UWHwc>
.
|
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.