dcapwell commented on code in PR #38:
URL: https://github.com/apache/cassandra-accord/pull/38#discussion_r1162130303


##########
accord-core/src/main/java/accord/local/CommandStores.java:
##########
@@ -416,6 +422,35 @@ public synchronized void shutdown()
             shard.store.shutdown();
     }
 
+    public CommandStore from(Routables<?, ?> routables)
+    {
+        return from(routables::intersects);
+    }
+
+    public CommandStore from(RoutingKey key)
+    {
+        return  from(ranges -> ranges.contains(key));
+    }
+
+    private CommandStore from(Predicate<Ranges> fn)
+    {
+        ShardHolder[] shards = current.shards;
+        for (ShardHolder holder : shards)
+        {
+            if (fn.test(holder.ranges().currentRanges()))
+                return holder.store;
+        }
+        return any();
+    }
+
+    @VisibleForTesting
+    public CommandStore any()

Review Comment:
   I tried getting rid of the 2 other test usage and both need this... 
`MessageTask` looks fine to get rid of (testing now), but 
`accord.burn.TopologyUpdates.CommandSync#process` needs to run inside a 
`CommandStore` and there isn't anything really to select which one... so need a 
random one...



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