pvcnt commented on code in PR #2039:
URL: https://github.com/apache/solr/pull/2039#discussion_r1410854522


##########
solr/solrj/src/java/org/apache/solr/common/cloud/ReplicaCount.java:
##########
@@ -61,6 +152,33 @@ public boolean contains(Replica.Type type) {
     return countByType.containsKey(type);
   }
 
+  /** Returns the replica types for which a number of replicas was explicitely 
defined. */
+  public Set<Replica.Type> keySet() {
+    return countByType.keySet();
+  }
+
+  /**
+   * Add properties for replica counts as integers to a properties map.
+   *
+   * @param propMap a properties map.
+   */
+  public void writeProps(Map<String, Object> propMap) {
+    for (Map.Entry<Replica.Type, Integer> entry : countByType.entrySet()) {
+      propMap.put(entry.getKey().numReplicasPropertyName, entry.getValue());
+    }
+  }
+
+  /**
+   * Add properties for replica counts as integers to Solr parameters.
+   *
+   * @param params a set of modifiable Solr parameters.
+   */
+  public void writeProps(ModifiableSolrParams params) {
+    for (Map.Entry<Replica.Type, Integer> entry : countByType.entrySet()) {
+      params.add(entry.getKey().numReplicasPropertyName, 
String.valueOf(entry.getValue()));

Review Comment:
   Excellent, changed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to