bdeggleston commented on code in PR #106:
URL: https://github.com/apache/cassandra-accord/pull/106#discussion_r1700850213


##########
accord-core/src/main/java/accord/local/CommandsForKey.java:
##########
@@ -372,112 +483,208 @@ public String toString()
             return "Info{" +
                    "txnId=" + toPlainString() +
                    ", status=" + status +
-                   ", executeAt=" + (executeAt == this ? toPlainString() : 
executeAt.toString()) +
+                   ", executeAt=" + plainExecuteAt() +
                    '}';
         }
 
         public String toPlainString()
         {
             return super.toString();
         }
+
+        public int compareExecuteAt(TxnInfo that)
+        {
+            return this.executeAt.compareTo(that.executeAt);
+        }
+
+        Timestamp executeAtIfKnownElseTxnId()
+        {
+            return status == INVALID_OR_TRUNCATED ? this : executeAt;
+        }
     }
 
-    public static class TxnInfoWithMissing extends TxnInfo
+    public static class TxnInfoExtra extends TxnInfo
     {
         public final TxnId[] missing;
+        public final Ballot ballot;
 
-        TxnInfoWithMissing(TxnId txnId, InternalStatus status, Timestamp 
executeAt, TxnId[] missing)
+        TxnInfoExtra(TxnId txnId, InternalStatus status, Timestamp executeAt, 
TxnId[] missing, Ballot ballot)
         {
             super(txnId, status, executeAt);
             this.missing = missing;
+            this.ballot = ballot;
         }
 
+        @Override
         public TxnId[] missing()
         {
             return missing;
         }
 
+        @Override
+        public Ballot ballot()
+        {
+            return ballot;
+        }
+
+        public TxnInfo update(TxnId[] newMissing)
+        {
+            if (newMissing == missing)
+                return this;
+
+            return newMissing == NO_TXNIDS && ballot == Ballot.ZERO
+                   ? new TxnInfo(this, status, executeAt)
+                   : new TxnInfoExtra(this, status, executeAt, newMissing, 
ballot);
+        }
+
         @Override
         public String toString()
         {
             return "Info{" +
                    "txnId=" + toPlainString() +
                    ", status=" + status +
-                   ", executeAt=" + (this == executeAt ? toPlainString() : 
executeAt) +
+                   ", executeAt=" + plainExecuteAt() +
+                   (ballot != Ballot.ZERO ? ", ballot=" + ballot : "") +
                    ", missing=" + Arrays.toString(missing) +
                    '}';
         }
     }
 
     private final Key key;
     private final RedundantBefore.Entry redundantBefore;
+    private final TxnInfo prunedBefore;
+    // TODO (desired): avoid loading if we know a transaction that should have 
witnessed it has already been registered/applied
+    private final Object[] loadingPruned;

Review Comment:
   comment on the field is fine



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