You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by dc...@apache.org on 2022/11/02 17:51:08 UTC

[cassandra-accord] branch trunk updated: Updated Commit.Invalidate to use proper message type, added nullable annotation to AcceptOk to show that Deps may be null, and added utility method on Status to check for both types of invalidate (#11)

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-accord.git


The following commit(s) were added to refs/heads/trunk by this push:
     new a810742  Updated Commit.Invalidate to use proper message type, added nullable annotation to AcceptOk to show that Deps may be null, and added utility method on Status to check for both types of invalidate (#11)
a810742 is described below

commit a81074297e9148f39a03a1be169f97857747843d
Author: dcapwell <dc...@gmail.com>
AuthorDate: Wed Nov 2 10:51:02 2022 -0700

    Updated Commit.Invalidate to use proper message type, added nullable annotation to AcceptOk to show that Deps may be null, and added utility method on Status to check for both types of invalidate (#11)
    
    
    patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-17103
---
 accord-core/src/main/java/accord/local/Status.java    | 12 ++++++++++++
 accord-core/src/main/java/accord/messages/Accept.java |  3 +++
 accord-core/src/main/java/accord/messages/Commit.java |  2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/accord-core/src/main/java/accord/local/Status.java b/accord-core/src/main/java/accord/local/Status.java
index e011764..01f9fba 100644
--- a/accord-core/src/main/java/accord/local/Status.java
+++ b/accord-core/src/main/java/accord/local/Status.java
@@ -52,4 +52,16 @@ public enum Status
     {
         return compareTo(equalOrGreaterThan) >= 0;
     }
+
+    public boolean isInvalidated()
+    {
+        switch (this)
+        {
+            case AcceptedInvalidate:
+            case Invalidated:
+                return true;
+            default:
+                return false;
+        }
+    }
 }
diff --git a/accord-core/src/main/java/accord/messages/Accept.java b/accord-core/src/main/java/accord/messages/Accept.java
index 14e347f..275b569 100644
--- a/accord-core/src/main/java/accord/messages/Accept.java
+++ b/accord-core/src/main/java/accord/messages/Accept.java
@@ -32,6 +32,8 @@ import com.google.common.annotations.VisibleForTesting;
 
 import java.util.Collections;
 
+import javax.annotation.Nullable;
+
 import static accord.messages.PreAccept.calculateDeps;
 
 public class Accept extends WithUnsynced
@@ -184,6 +186,7 @@ public class Accept extends WithUnsynced
     public static class AcceptOk implements AcceptReply
     {
         public final TxnId txnId;
+        @Nullable
         public final Deps deps;
 
         public AcceptOk(TxnId txnId, Deps deps)
diff --git a/accord-core/src/main/java/accord/messages/Commit.java b/accord-core/src/main/java/accord/messages/Commit.java
index 4daab5b..5f6702d 100644
--- a/accord-core/src/main/java/accord/messages/Commit.java
+++ b/accord-core/src/main/java/accord/messages/Commit.java
@@ -213,7 +213,7 @@ public class Commit extends ReadData
         @Override
         public MessageType type()
         {
-            return MessageType.COMMIT_REQ;
+            return MessageType.COMMIT_INVALIDATE;
         }
 
         @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org