sanpwc commented on code in PR #4256:
URL: https://github.com/apache/ignite-3/pull/4256#discussion_r1761417556


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/server/impl/JraftServerImpl.java:
##########
@@ -856,4 +860,54 @@ public void onLeaderStart(long term) {
             listener.onLeaderStart();
         }
     }
+
+    /** Returns raft group state accessor. */
+    public <G extends ReplicationGroupId, L> RaftGroupStateProvider<G, L> 
getGroupStateProvider(
+            Class<G> groupType,
+            Class<L> groupListenerType
+    ) {
+        return new StateProviderImpl<>(groupType, groupListenerType, nodes);
+    }
+
+    private static class StateProviderImpl<G extends ReplicationGroupId, L> 
implements RaftGroupStateProvider<G, L> {
+
+        private final Class<G> groupType;
+
+        private final Class<L> listenerType;
+
+        private final Map<RaftNodeId, RaftGroupService> nodes;
+
+        StateProviderImpl(
+                Class<G> groupType,
+                Class<L> listenerType,
+                Map<RaftNodeId, RaftGroupService> nodes
+        ) {
+            this.groupType = groupType;
+            this.listenerType = listenerType;
+            this.nodes = nodes;
+        }
+
+        @Override
+        public <V> Map<G, V> getState(Function<L, V> stateFunc) {
+            Map<G, V> result = new HashMap<>();
+
+            for (Map.Entry<RaftNodeId, RaftGroupService> entry : 
nodes.entrySet()) {

Review Comment:
   You are going to match retrieved result with full partitions set in order to 
check whether all partitions are taken into consideration, right?



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

Reply via email to