murblanc commented on a change in pull request #1528: URL: https://github.com/apache/lucene-solr/pull/1528#discussion_r429817725
########## File path: solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java ########## @@ -210,47 +200,42 @@ public boolean liveNodesContain(String name) { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("znodeVersion: ").append(znodeVersion); - sb.append("\n"); sb.append("live nodes:").append(liveNodes); sb.append("\n"); sb.append("collections:").append(collectionStates); return sb.toString(); } - public static ClusterState load(Integer version, byte[] bytes, Set<String> liveNodes) { - return load(version, bytes, liveNodes, ZkStateReader.CLUSTER_STATE); - } /** - * Create ClusterState from json string that is typically stored in zookeeper. + * Create a ClusterState from Json. * - * @param version zk version of the clusterstate.json file (bytes) - * @param bytes clusterstate.json as a byte array + * @param bytes a byte array of a Json representation of a mapping from collection name to the Json representation of a + * {@link DocCollection} as written by {@link #write(JSONWriter)}. It can represent + * one or more collections. * @param liveNodes list of live nodes * @return the ClusterState */ - public static ClusterState load(Integer version, byte[] bytes, Set<String> liveNodes, String znode) { - // System.out.println("######## ClusterState.load:" + (bytes==null ? null : new String(bytes))); + public static ClusterState createFromJson(int version, byte[] bytes, Set<String> liveNodes) { if (bytes == null || bytes.length == 0) { - return new ClusterState(version, liveNodes, Collections.<String, DocCollection>emptyMap()); + return new ClusterState(liveNodes, Collections.<String, DocCollection>emptyMap()); } Map<String, Object> stateMap = (Map<String, Object>) Utils.fromJSON(bytes); - return load(version, stateMap, liveNodes, znode); + return createFromData(version, stateMap, liveNodes); } - public static ClusterState load(Integer version, Map<String, Object> stateMap, Set<String> liveNodes, String znode) { + public static ClusterState createFromData(int version, Map<String, Object> stateMap, Set<String> liveNodes) { Review comment: As you wish, let me know and I'll change it as I rework the other comments. `createFromIntMapAndSet` :) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org