Github user kanakb commented on a diff in the pull request: https://github.com/apache/helix/pull/31#discussion_r33892268 --- Diff: helix-core/src/main/java/org/apache/helix/spectator/RoutingTableProvider.java --- @@ -73,6 +75,73 @@ public RoutingTableProvider() { } /** + * returns the instances for {resource,partition} pair that are in a specific {state} if + * aggregateGrouping is turned on, find all resources belongs to the given resourceGroupName and + * aggregate all partition states from all these resources. + * + * @param resourceName + * @param partitionName + * @param state + * @param groupingEnabled + * + * @return empty list if there is no instance in a given state + */ + public List<InstanceConfig> getInstances(String resourceName, String partitionName, String state, + boolean groupingEnabled) { + if (!groupingEnabled) { + return getInstances(resourceName, partitionName, state); + } + + List<InstanceConfig> instanceList = null; + RoutingTable _routingTable = _routingTableRef.get(); + ResourceGroupInfo resourceGroupInfo = _routingTable.getResourceGroup(resourceName); + if (resourceGroupInfo != null) { + PartitionInfo keyInfo = resourceGroupInfo.get(partitionName); + if (keyInfo != null) { + instanceList = keyInfo.get(state); + } + } + if (instanceList == null) { + instanceList = Collections.emptyList(); + } + return instanceList; + } + + /** + * returns the instances for {resource,partition} pair that are in a specific {state} if + * aggregateGrouping is turned on, find all resources belongs to the given resourceGroupName and + * having the given resource tags and return the aggregated partition states from all these + * resources. + * + * @param resourceGroupName + * @param partitionName + * @param state + * @param resourceTags + * + * @return empty list if there is no instance in a given state + */ + public List<InstanceConfig> getInstances(String resourceGroupName, String partitionName, --- End diff -- Can you clarify the expected naming pattern for partitions in a resource group? Do all resources have partitions with the same name, or do some, or do none? Does this basically look at every resource in the resource group for partitions that match, and then return all instances for all partitions with this name in the resources for this resource group?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---