[ https://issues.apache.org/jira/browse/SOLR-8323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15263038#comment-15263038 ]
ASF GitHub Bot commented on SOLR-8323: -------------------------------------- Github user dragonsinth commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/32#discussion_r61504824 --- Diff: solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java --- @@ -210,6 +213,38 @@ public Replica getReplica(String coreNodeName) { return null; } + /** + * Check that all replicas in a collection are live + * + * @see CollectionStatePredicate + */ + public static boolean isFullyActive(Set<String> liveNodes, DocCollection collectionState) { + Objects.requireNonNull(liveNodes); + if (collectionState == null) + return false; + for (Slice slice : collectionState) { + for (Replica replica : slice) { + if (replica.isActive(liveNodes) == false) + return false; + } + } + return true; + } + + /** + * Returns true if the passed in DocCollection is null + * + * @see CollectionStatePredicate + */ + public static boolean isDeleted(Set<String> liveNodes, DocCollection collectionState) { + return collectionState == null; + } --- End diff -- maybe `exists`? isDeleted implies that it used to exist, but it may have never been created > Add CollectionWatcher API to ZkStateReader > ------------------------------------------ > > Key: SOLR-8323 > URL: https://issues.apache.org/jira/browse/SOLR-8323 > Project: Solr > Issue Type: Improvement > Affects Versions: master > Reporter: Alan Woodward > Assignee: Alan Woodward > Attachments: SOLR-8323.patch, SOLR-8323.patch, SOLR-8323.patch, > SOLR-8323.patch > > > An API to watch for changes to collection state would be a generally useful > thing, both internally and for client use. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org