dcapwell commented on code in PR #38:
URL: https://github.com/apache/cassandra-accord/pull/38#discussion_r1162111484
##########
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 think I can get rid of this. This used to play a bigger role but after a
few refactors its now only used as the fallback case with 2 test cases using...
I will look to see if I can move the test usage off `CommandStore` and into the
new global executor for `BurnTest`... that would allow this method to become
private
> Even having the lookup by key/range/routable is somewhat undesirable
because in so many cases you already know what the correct command store and
should use that.
that's for the case where you are not running in a CommandStore, such as
`accord.coordinate.Coordinate#start` which runs in C* space (executed by
`TransactionStatement`)
--
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]