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


##########
accord-core/src/test/java/accord/topology/TopologyRandomizer.java:
##########
@@ -26,64 +26,99 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.BiFunction;
 import java.util.function.Function;
 import java.util.function.Supplier;
 import javax.annotation.Nullable;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Sets;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import accord.burn.TopologyUpdates;
-import accord.impl.IntHashKey;
-import accord.impl.IntHashKey.Hash;
+import accord.impl.PrefixedIntHashKey;
+import accord.impl.PrefixedIntHashKey.Hash;
 import accord.local.Node;
 import accord.primitives.Range;
 import accord.primitives.Ranges;
 import accord.utils.Invariants;
 import accord.utils.RandomSource;
+import org.agrona.collections.IntHashSet;
 
 
 // TODO (required, testing): add change replication factor
 public class TopologyRandomizer
 {
+    public interface Listener
+    {
+        void onUpdate(Topology topology);
+    }
+
+    public enum Listeners implements Listener
+    {
+        NOOP
+        {
+            @Override
+            public void onUpdate(Topology topology)
+            {
+
+            }
+        }
+    }
+
+    private static class State

Review Comment:
   `addPrefix`/`removePrefix` needs to know what is the highest prefix seen so 
far so have a counter for that, but since we are using enums we can't pass this 
state into `<init>` and instead have to pass this into the call site...  I 
"could" just pass in the counter to all functions but felt this way was 
slightly better... more than glad to rework this as I really don't like it



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