|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | +package org.apache.solr.client.api.model; |
| 18 | + |
| 19 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| 20 | +import com.fasterxml.jackson.annotation.JsonAnySetter; |
| 21 | +import com.fasterxml.jackson.annotation.JsonFormat; |
| 22 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 23 | +import java.util.Date; |
| 24 | +import java.util.HashMap; |
| 25 | +import java.util.List; |
| 26 | +import java.util.Map; |
| 27 | + |
| 28 | +/** |
| 29 | + * Response of the CollectionStatusApi.getCollectionStatus() API |
| 30 | + * |
| 31 | + * <p>Note that the corresponding v1 API has a slightly different response format. Users should not |
| 32 | + * attempt to convert a v1 response into this type. |
| 33 | + */ |
| 34 | +public class CollectionStatusResponse extends SolrJerseyResponse { |
| 35 | + |
| 36 | + @JsonProperty public String name; |
| 37 | + @JsonProperty public Integer znodeVersion; |
| 38 | + |
| 39 | + // TODO - consider 'Instant' once SOLR-17608 is finished |
| 40 | + @JsonProperty |
| 41 | + @JsonFormat(shape = JsonFormat.Shape.NUMBER) |
| 42 | + public Date creationTimeMillis; |
| 43 | + |
| 44 | + @JsonProperty public CollectionMetadata properties; |
| 45 | + @JsonProperty public Integer activeShards; |
| 46 | + @JsonProperty public Integer inactiveShards; |
| 47 | + @JsonProperty public List<String> schemaNonCompliant; |
| 48 | + |
| 49 | + @JsonProperty public Map<String, ShardMetadata> shards; |
| 50 | + |
| 51 | + // Always present in response |
| 52 | + public static class CollectionMetadata { |
| 53 | + @JsonProperty public String configName; |
| 54 | + @JsonProperty public Integer nrtReplicas; |
| 55 | + @JsonProperty public Integer pullReplicas; |
| 56 | + @JsonProperty public Integer tlogReplicas; |
| 57 | + @JsonProperty public Map<String, String> router; |
| 58 | + @JsonProperty public Integer replicationFactor; |
| 59 | + |
| 60 | + private Map<String, Object> unknownFields = new HashMap<>(); |
| 61 | + |
| 62 | + @JsonAnyGetter |
| 63 | + public Map<String, Object> unknownProperties() { |
| 64 | + return unknownFields; |
| 65 | + } |
| 66 | + |
| 67 | + @JsonAnySetter |
| 68 | + public void setUnknownProperty(String field, Object value) { |
| 69 | + unknownFields.put(field, value); |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + // Always present in response |
| 74 | + public static class ShardMetadata { |
| 75 | + @JsonProperty public String state; // TODO Make this an enum? |
| 76 | + @JsonProperty public String range; |
| 77 | + @JsonProperty public ReplicaSummary replicas; |
| 78 | + @JsonProperty public LeaderSummary leader; |
| 79 | + } |
| 80 | + |
| 81 | + // Always present in response |
| 82 | + public static class ReplicaSummary { |
| 83 | + @JsonProperty public Integer total; |
| 84 | + @JsonProperty public Integer active; |
| 85 | + @JsonProperty public Integer down; |
| 86 | + @JsonProperty public Integer recovering; |
| 87 | + |
| 88 | + @JsonProperty("recovery_failed") |
| 89 | + public Integer recoveryFailed; |
| 90 | + } |
| 91 | + |
| 92 | + // Always present in response unless otherwise specified |
| 93 | + public static class LeaderSummary { |
| 94 | + @JsonProperty public String coreNode; |
| 95 | + @JsonProperty public String core; |
| 96 | + @JsonProperty public Boolean leader; |
| 97 | + |
| 98 | + @JsonProperty("node_name") |
| 99 | + public String nodeName; |
| 100 | + |
| 101 | + @JsonProperty("base_url") |
| 102 | + public String baseUrl; |
| 103 | + |
| 104 | + @JsonProperty public String state; // TODO Make this an enum? |
| 105 | + @JsonProperty public String type; // TODO Make this an enum? |
| 106 | + |
| 107 | + @JsonProperty("force_set_state") |
| 108 | + public Boolean forceSetState; |
| 109 | + |
| 110 | + // Present with coreInfo=true || sizeInfo=true unless otherwise specified |
| 111 | + @JsonProperty public SegmentInfo segInfos; |
| 112 | + |
| 113 | + private Map<String, Object> unknownFields = new HashMap<>(); |
| 114 | + |
| 115 | + @JsonAnyGetter |
| 116 | + public Map<String, Object> unknownProperties() { |
| 117 | + return unknownFields; |
| 118 | + } |
| 119 | + |
| 120 | + @JsonAnySetter |
| 121 | + public void setUnknownProperty(String field, Object value) { |
| 122 | + unknownFields.put(field, value); |
| 123 | + } |
| 124 | + } |
| 125 | + |
| 126 | + // Present with segments=true || coreInfo=true || sizeInfo=true || fieldInfo=true unless otherwise |
| 127 | + // specified |
| 128 | + |
| 129 | + /** |
| 130 | + * Same properties as {@link GetSegmentDataResponse}, but uses a different class to avoid |
| 131 | + * inheriting "responseHeader", etc. |
| 132 | + */ |
| 133 | + public static class SegmentInfo { |
| 134 | + @JsonProperty public GetSegmentDataResponse.SegmentSummary info; |
| 135 | + |
| 136 | + @JsonProperty public Map<String, Object> runningMerges; |
| 137 | + |
| 138 | + // Present with segments=true || sizeInfo=true || fieldInfo=true |
| 139 | + @JsonProperty public Map<String, GetSegmentDataResponse.SingleSegmentData> segments; |
| 140 | + |
| 141 | + // Present with rawSize=true |
| 142 | + @JsonProperty public GetSegmentDataResponse.RawSize rawSize; |
| 143 | + |
| 144 | + // Present only with fieldInfo=true |
| 145 | + @JsonProperty public List<String> fieldInfoLegend; |
| 146 | + } |
| 147 | +} |
0 commit comments