This is an automated email from the ASF dual-hosted git repository.

dcapwell pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-in-jvm-dtest-api.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c845378  Renamed isAllowVnodes and disallowVNodes to allow more 
control over when vnode or single token are supported (#32)
c845378 is described below

commit c8453789f8934ebbd817eef09994459c122a72f1
Author: dcapwell <[email protected]>
AuthorDate: Mon Mar 28 11:29:33 2022 -0700

    Renamed isAllowVnodes and disallowVNodes to allow more control over when 
vnode or single token are supported (#32)
    
    
    patch by David Capwell; reviewed by Alex Petrov, Josh McKenzie for 
CASSANDRA-17332
---
 CHANGES.txt                                        |  4 ++++
 .../distributed/shared/AbstractBuilder.java        | 23 +++++++++++++++++-----
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 31963b0..707813c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,7 @@
+# 0.0.13
+
+CASSANDRA-17332: Add support for vnodes in jvm-dtest
+
 # 0.0.12
 
 CASSANDRA-17214:Add IInstance.isValid() with default true return value
diff --git 
a/src/main/java/org/apache/cassandra/distributed/shared/AbstractBuilder.java 
b/src/main/java/org/apache/cassandra/distributed/shared/AbstractBuilder.java
index 665cdc5..c9712df 100644
--- a/src/main/java/org/apache/cassandra/distributed/shared/AbstractBuilder.java
+++ b/src/main/java/org/apache/cassandra/distributed/shared/AbstractBuilder.java
@@ -42,6 +42,8 @@ import static 
org.apache.cassandra.distributed.api.TokenSupplier.evenlyDistribut
 
 public abstract class AbstractBuilder<I extends IInstance, C extends ICluster, 
B extends AbstractBuilder<I, C, B>>
 {
+    private enum VNodeState
+    { SUPPORT_ALL, ONLY_SINGLE_TOKEN, ONLY_VNODE }
     public interface Factory<I extends IInstance, C extends ICluster, B 
extends AbstractBuilder<I, C, B>>
     {
         C newCluster(B builder);
@@ -65,7 +67,7 @@ public abstract class AbstractBuilder<I extends IInstance, C 
extends ICluster, B
     private final List<Rack> racks = new ArrayList<>();
     private boolean finalised;
     private int tokenCount = getDefaultTokenCount();
-    private boolean allowVnodes = true;
+    private VNodeState vnodeState = VNodeState.SUPPORT_ALL;
 
     protected int getDefaultTokenCount() {
         String key = "cassandra.dtest.num_tokens";
@@ -149,8 +151,13 @@ public abstract class AbstractBuilder<I extends IInstance, 
C extends ICluster, B
         return tokenCount;
     }
 
-    public boolean isAllowVnodes() {
-        return allowVnodes;
+    public boolean isVNodeAllowed() {
+        return vnodeState != VNodeState.ONLY_SINGLE_TOKEN;
+    }
+
+    public boolean isSingleTokenAllowed()
+    {
+        return vnodeState != VNodeState.ONLY_VNODE;
     }
 
     public C start() throws IOException
@@ -387,9 +394,15 @@ public abstract class AbstractBuilder<I extends IInstance, 
C extends ICluster, B
         return (B) this;
     }
 
-    public B disallowVNodes()
+    public B withVNodes()
+    {
+        vnodeState = VNodeState.ONLY_VNODE;
+        return (B) this;
+    }
+
+    public B withoutVNodes()
     {
-        this.allowVnodes = false;
+        vnodeState = VNodeState.ONLY_SINGLE_TOKEN;
         return (B) this;
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to