|
26 | 26 | */ |
27 | 27 | public class DbInfo { |
28 | 28 |
|
| 29 | + /** |
| 30 | + * Encapsulates partitioned index properties. |
| 31 | + */ |
| 32 | + public static class PartitionedIndexes { |
| 33 | + |
| 34 | + /** |
| 35 | + * Encapsulates index properties. |
| 36 | + */ |
| 37 | + public static class Indexes { |
| 38 | + |
| 39 | + private long search; |
| 40 | + private long view; |
| 41 | + |
| 42 | + |
| 43 | + /** |
| 44 | + * Get a count of the partitioned search indexes. |
| 45 | + * |
| 46 | + * @return The partitioned search index count. |
| 47 | + */ |
| 48 | + public long getSearch() { |
| 49 | + return search; |
| 50 | + } |
| 51 | + |
| 52 | + |
| 53 | + /** |
| 54 | + * Get a count of the partitioned view indexes. |
| 55 | + * |
| 56 | + * @return The partitioned view index count. |
| 57 | + */ |
| 58 | + public long getView() { |
| 59 | + return view; |
| 60 | + } |
| 61 | + |
| 62 | + } |
| 63 | + |
| 64 | + private long count; |
| 65 | + private long limit; |
| 66 | + private Indexes indexes; |
| 67 | + |
| 68 | + /** |
| 69 | + * Get a total count of the partitioned indexes. |
| 70 | + * |
| 71 | + * @return The total partitioned index count. |
| 72 | + */ |
| 73 | + public long getCount() { |
| 74 | + return count; |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Get the partitioned index limit. |
| 79 | + * |
| 80 | + * @return The partitioned index limit. |
| 81 | + */ |
| 82 | + public long getLimit() { |
| 83 | + return limit; |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * Get the {@link com.cloudant.client.api.model.DbInfo.PartitionedIndexes.Indexes} object |
| 88 | + * for this database. |
| 89 | + * |
| 90 | + * @return The {@link com.cloudant.client.api.model.DbInfo.PartitionedIndexes.Indexes} |
| 91 | + * object, containing the count breakdown of partitioned indexes. |
| 92 | + */ |
| 93 | + public Indexes getIndexes() { |
| 94 | + return indexes; |
| 95 | + } |
| 96 | + |
| 97 | + } |
| 98 | + |
29 | 99 | /** |
30 | 100 | * Encapsulates database properties. |
31 | 101 | */ |
@@ -62,6 +132,8 @@ public boolean getPartitioned() { |
62 | 132 | @SerializedName("disk_format_version") |
63 | 133 | private int diskFormatVersion; |
64 | 134 | private Props props; |
| 135 | + @SerializedName("partitioned_indexes") |
| 136 | + private PartitionedIndexes partitionedIndexes; |
65 | 137 |
|
66 | 138 | public String getDbName() { |
67 | 139 | return dbName; |
@@ -137,15 +209,51 @@ public Props getProps() { |
137 | 209 | return props; |
138 | 210 | } |
139 | 211 |
|
| 212 | + /** |
| 213 | + * Get the {@link com.cloudant.client.api.model.DbInfo.PartitionedIndexes} object for |
| 214 | + * this database. |
| 215 | + * |
| 216 | + * @return The {@link com.cloudant.client.api.model.DbInfo.PartitionedIndexes} object, |
| 217 | + * containing metadata about partitioned indexes in this database. |
| 218 | + */ |
| 219 | + public PartitionedIndexes getPartitionedIndexes() { |
| 220 | + return partitionedIndexes; |
| 221 | + } |
| 222 | + |
140 | 223 | @Override |
141 | 224 | public String toString() { |
142 | | - return String |
143 | | - .format("CouchDbInfo [dbName=%s, docCount=%s, docDelCount=%s, updateSeq=%s, " + |
144 | | - "purgeSeq=%s, compactRunning=%s, diskSize=%s, instanceStartTime=%s, diskFormatVersion=%s]", |
145 | | - dbName, docCount, docDelCount, updateSeq, purgeSeq, |
146 | | - compactRunning, diskSize, instanceStartTime, |
147 | | - diskFormatVersion); |
148 | | - } |
| 225 | + StringBuilder sb = new StringBuilder(); |
| 226 | + sb |
| 227 | + .append("CouchDbInfo [") |
| 228 | + .append("dbName=").append(dbName) |
| 229 | + .append(", docCount=").append(docCount) |
| 230 | + .append(", docDelCount=").append(docDelCount) |
| 231 | + .append(", updateSeq=").append(updateSeq) |
| 232 | + .append(", purgeSeq=").append(purgeSeq) |
| 233 | + .append(", compactRunning=").append(compactRunning) |
| 234 | + .append(", diskSize=").append(diskSize) |
| 235 | + .append(", instanceStartTime=").append(instanceStartTime) |
| 236 | + .append(", diskFormatVersion=").append(diskFormatVersion); |
| 237 | + |
| 238 | + if (this.getProps() != null) { |
| 239 | + sb.append(", props.partitioned=").append(this.getProps().getPartitioned()); |
| 240 | + } |
| 241 | + |
| 242 | + if (this.getPartitionedIndexes() != null) { |
| 243 | + sb |
| 244 | + .append(", partitionedIndexes.count=") |
| 245 | + .append(this.getPartitionedIndexes().getCount()) |
| 246 | + .append(", partitionedIndexes.limit=") |
| 247 | + .append(this.getPartitionedIndexes().getLimit()) |
| 248 | + .append(", partitionedIndexes.indexes.search=") |
| 249 | + .append(this.getPartitionedIndexes().getIndexes().getSearch()) |
| 250 | + .append(", partitionedIndexes.indexes.view=") |
| 251 | + .append(this.getPartitionedIndexes().getIndexes().getView()); |
| 252 | + } |
149 | 253 |
|
| 254 | + sb.append("]"); |
| 255 | + |
| 256 | + return sb.toString(); |
| 257 | + } |
150 | 258 |
|
151 | 259 | } |
0 commit comments