-
Notifications
You must be signed in to change notification settings - Fork 692
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
SOLR-16391: Convert create-core, core-status to JAX-RS #3054
Merged
gerlowskija
merged 17 commits into
apache:main
from
gerlowskija:SOLR-16391-convert-create-core-to-jaxrs
Feb 22, 2025
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9bd4177
SOLR-16391: Convert create-core to JAX-RS
gerlowskija f21a7ff
Fix tests, 1
gerlowskija 72d5e2a
WIP: single and multi-core status JAX-RS conversion
gerlowskija 4b3f561
Finish off core-status conversion, mostly
gerlowskija efc080a
Fix tests, partial
gerlowskija faaf869
Replace 'CoreStatus' with 'SingleCoreData' (main only)
gerlowskija d13f62f
Remove unnecessary TestCoreAdminApis
gerlowskija 420a752
Generated v2 req/rsp usage
gerlowskija 1f92fb8
Fix lingering test failures
gerlowskija 8cc55d6
Merge branch 'main' into SOLR-16391-convert-create-core-to-jaxrs
gerlowskija ba14d85
Remove unused method
gerlowskija 28ba4b3
Address several NOCOMMITs
gerlowskija 2d557aa
Address final NOCOMMIT
gerlowskija a7d2238
Add ref-guide docs for tweaked create-core
gerlowskija a41817d
Merge branch 'main' into SOLR-16391-convert-create-core-to-jaxrs
gerlowskija 9dbcda5
Merge branch 'main' into SOLR-16391-convert-create-core-to-jaxrs
gerlowskija 4891049
'api' module should advertise jackson-annotations dep
gerlowskija File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
solr/api/src/java/org/apache/solr/client/api/endpoint/CoreApis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* 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.client.api.endpoint; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.POST; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.PathParam; | ||
import jakarta.ws.rs.QueryParam; | ||
import org.apache.solr.client.api.model.CoreStatusResponse; | ||
import org.apache.solr.client.api.model.CreateCoreParams; | ||
import org.apache.solr.client.api.model.CreateCoreResponse; | ||
|
||
public interface CoreApis { | ||
|
||
/** V2 API definition for creating a core on the receiving Solr node */ | ||
@Path("/cores") | ||
interface Create { | ||
@POST | ||
@Operation(summary = "Create a new core on the receiving Solr node.", tags = "cores") | ||
CreateCoreResponse createCore(CreateCoreParams requestBody) throws Exception; | ||
} | ||
|
||
@Path("/cores") | ||
interface GetStatus { | ||
|
||
@GET | ||
@Operation(summary = "Fetch status info for all cores hosted on this node.", tags = "cores") | ||
CoreStatusResponse getAllCoreStatus(@QueryParam("indexInfo") Boolean indexInfo) | ||
throws Exception; | ||
|
||
@GET | ||
@Operation( | ||
summary = "Fetch status info for the core hosted on this node with the specified name.", | ||
tags = "cores") | ||
@Path("/{coreName}") | ||
CoreStatusResponse getCoreStatus( | ||
@PathParam("coreName") String coreName, @QueryParam("indexInfo") Boolean indexInfo) | ||
throws Exception; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
solr/api/src/java/org/apache/solr/client/api/model/CoreStatusResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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.client.api.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Date; | ||
import java.util.Map; | ||
|
||
public class CoreStatusResponse extends SolrJerseyResponse { | ||
|
||
// Map values are often exceptions on the server side, but often serialized as strings. | ||
@JsonProperty public Map<String, Object> initFailures; | ||
|
||
@JsonProperty public Map<String, SingleCoreData> status; | ||
|
||
public static class SingleCoreData { | ||
@JsonProperty public String name; | ||
|
||
@JsonProperty public Boolean isLoaded; | ||
@JsonProperty public Boolean isLoading; | ||
|
||
@JsonProperty public String instanceDir; | ||
@JsonProperty public String dataDir; | ||
@JsonProperty public String config; | ||
@JsonProperty public String schema; | ||
@JsonProperty public Date startTime; | ||
@JsonProperty public Long uptime; | ||
@JsonProperty public String lastPublished; | ||
@JsonProperty public Integer configVersion; | ||
@JsonProperty public CloudDetails cloud; | ||
@JsonProperty public IndexDetails index; | ||
} | ||
|
||
public static class CloudDetails { | ||
@JsonProperty public String collection; | ||
@JsonProperty public String shard; | ||
@JsonProperty public String replica; | ||
@JsonProperty public String replicaType; // TODO enum? | ||
} | ||
|
||
public static class IndexDetails { | ||
@JsonProperty public Integer numDocs; | ||
@JsonProperty public Integer maxDoc; | ||
@JsonProperty public Integer deletedDocs; | ||
@JsonProperty public Long version; | ||
@JsonProperty public Integer segmentCount; | ||
@JsonProperty public Boolean current; | ||
@JsonProperty public Boolean hasDeletions; | ||
@JsonProperty public String directory; | ||
@JsonProperty public String segmentsFile; | ||
@JsonProperty public Long segmentsFileSizeInBytes; | ||
@JsonProperty public Map<String, String> userData; | ||
@JsonProperty public Date lastModified; | ||
@JsonProperty public Long sizeInBytes; | ||
@JsonProperty public String size; // Human readable representation of 'sizeInBytes' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
these
var
are a lot more readable...