-
Notifications
You must be signed in to change notification settings - Fork 804
SOLR-18072: Refactor CollectionApiCommands to add expandable context #4046
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
base: main
Are you sure you want to change the base?
Changes from all commits
920ba91
f2e3966
d9d4af3
1d73112
cfc219c
a2c39bc
320675c
9da3ee9
0967535
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc | ||
| title: Refactor CollectionApiCommands to add easily expandable AdminCmdContext argument | ||
| type: other # added, changed, fixed, deprecated, removed, dependency_update, security, other | ||
| authors: | ||
| - name: Houston Putman | ||
| nick: HoustonPutman | ||
| links: | ||
| - name: SOLR-18072 | ||
| url: https://issues.apache.org/jira/browse/SOLR-18072 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ | |
| import jakarta.ws.rs.Path; | ||
| import jakarta.ws.rs.PathParam; | ||
| import jakarta.ws.rs.QueryParam; | ||
| import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
| import org.apache.solr.client.api.model.SubResponseAccumulatingJerseyResponse; | ||
|
|
||
| @Path("/aliases/{aliasName}") | ||
| public interface DeleteAliasApi { | ||
|
|
@@ -32,7 +32,7 @@ public interface DeleteAliasApi { | |
| @Operation( | ||
| summary = "Deletes an alias by its name", | ||
| tags = {"aliases"}) | ||
| SolrJerseyResponse deleteAlias( | ||
| SubResponseAccumulatingJerseyResponse deleteAlias( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Q] Why are we narrowing the response schema of this API? Typically "SubResponseAccumulatingJerseyResponse" gets used for those admin APIs where the overseer sends out requests to individual replicas, etc. and includes each of those sub-responses in what gets returned to the original caller. But looking at DeleteAliasCmd, it doesn't seem to be doing anything like that? There's a (minor?) downside to doing this in that our OpenAPI spec (and everything that gets generated from it) will now look like the additional fields will be present in the API response. (Note: this question applies to a few of the files above as well, but just leaving it in this one place to avoid duplication.) |
||
| @Parameter(description = "The name of the alias to delete", required = true) | ||
| @PathParam("aliasName") | ||
| String aliasName, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.solr.cloud.api.collections; | ||
|
|
||
| import org.apache.solr.common.cloud.ClusterState; | ||
| import org.apache.solr.common.params.CollectionParams; | ||
|
|
||
| public class AdminCmdContext { | ||
| private final CollectionParams.CollectionAction action; | ||
| private final String asyncId; | ||
| private ClusterState clusterState; | ||
|
|
||
| public AdminCmdContext(CollectionParams.CollectionAction action) { | ||
| this(action, null); | ||
| } | ||
|
|
||
| public AdminCmdContext(CollectionParams.CollectionAction action, String asyncId) { | ||
| this.action = action; | ||
| this.asyncId = asyncId; | ||
| } | ||
|
|
||
| public CollectionParams.CollectionAction getAction() { | ||
| return action; | ||
| } | ||
|
|
||
| public String getAsyncId() { | ||
| return asyncId; | ||
| } | ||
|
|
||
| public ClusterState getClusterState() { | ||
| return clusterState; | ||
| } | ||
|
|
||
| public AdminCmdContext withClusterState(ClusterState clusterState) { | ||
| this.clusterState = clusterState; | ||
| return this; | ||
| } | ||
|
|
||
| public AdminCmdContext subRequestContext(CollectionParams.CollectionAction action) { | ||
| return subRequestContext(action, asyncId); | ||
| } | ||
|
|
||
| public AdminCmdContext subRequestContext( | ||
| CollectionParams.CollectionAction action, String asyncId) { | ||
| AdminCmdContext nextContext = new AdminCmdContext(action, asyncId); | ||
| return nextContext.withClusterState(clusterState); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.