zpinto commented on code in PR #2710:
URL: https://github.com/apache/helix/pull/2710#discussion_r1419842674


##########
helix-core/src/main/java/org/apache/helix/spectator/RoutingDataCache.java:
##########
@@ -150,6 +181,41 @@ public synchronized void refresh(HelixDataAccessor 
accessor) {
     }
   }
 
+  private void updateRoutableInstanceConfigMap(Map<String, InstanceConfig> 
instanceConfigMap) {
+    _routableInstanceConfigMap = instanceConfigMap.entrySet().stream().filter(
+            (instanceConfigEntry) -> 
!NON_ROUTABLE_INSTANCE_OPERATIONS.contains(
+                instanceConfigEntry.getValue().getInstanceOperation()))
+        .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+  }
+
+  private void updateRoutableLiveInstanceMap(Map<String, InstanceConfig> 
instanceConfigMap,
+      Map<String, LiveInstance> liveInstanceMap) {
+    _routableLiveInstanceMap = liveInstanceMap.entrySet().stream().filter(
+            (liveInstanceEntry) -> 
instanceConfigMap.containsKey(liveInstanceEntry.getKey())
+                && !NON_ROUTABLE_INSTANCE_OPERATIONS.contains(
+                
instanceConfigMap.get(liveInstanceEntry.getKey()).getInstanceOperation()))
+        .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+  }
+
+  /**
+   * Returns the LiveInstances for each of the routable instances that are 
currently up and
+   * running.
+   *
+   * @return a map of LiveInstances
+   */
+  public Map<String, LiveInstance> getRoutableLiveInstances() {
+    return Collections.unmodifiableMap(_routableLiveInstanceMap);
+  }
+
+  /**
+   * Returns the instance config map for all the routable instances that are 
in the cluster.
+   *
+   * @return a map of InstanceConfigs
+   */
+  public Map<String, InstanceConfig> getRoutableInstanceConfigMap() {

Review Comment:
   We have usage of this in RoutingTableProvider.



-- 
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