belliottsmith commented on code in PR #233:
URL: https://github.com/apache/cassandra-accord/pull/233#discussion_r2246284363


##########
accord-core/src/main/java/accord/local/CommandSummaries.java:
##########
@@ -60,185 +62,279 @@ enum SummaryStatus
         INVALIDATED;
 
         public static final SummaryStatus NONE = null;
+
+        private static final SummaryStatus[] SUMMARY_STATUSES = values();
     }
 
-    enum IsDep { IS_COORD_DEP, IS_NOT_COORD_DEP, NOT_ELIGIBLE, IS_STABLE_DEP, 
IS_NOT_STABLE_DEP }
+    enum IsDep
+    {
+        IS_COORD_DEP, IS_NOT_COORD_DEP, NOT_ELIGIBLE, IS_STABLE_DEP, 
IS_NOT_STABLE_DEP;
+        private static final IsDep[] IS_DEPS = values();
+    }
 
-    class Summary
+    class Summary extends TxnId
     {
-        public final @Nonnull TxnId txnId;
-        public final @Nonnull Timestamp executeAt;
-        public final @Nonnull SummaryStatus status;
-        public final @Nonnull Unseekables<?> participants;
+        private static final int SUMMARY_STATUS_MASK = 0x7;
+        private static final int IS_DEP_SHIFT = 3;
+        final @Nonnull Timestamp executeAt;
+        final int encoded;
+        final Unseekables<?> participants;
 
-        public final IsDep dep;
-        public final TxnId findAsDep;
+        public Summary slice(Ranges ranges)
+        {
+            return new Summary(this, this.executeAt, encoded, 
participants.slice(ranges, Minimal));
+        }
 
         @VisibleForTesting
-        public Summary(@Nonnull TxnId txnId, @Nonnull Timestamp executeAt, 
@Nonnull SummaryStatus status, @Nonnull Unseekables<?> participants, IsDep dep, 
TxnId findAsDep)
+        public Summary(@Nonnull TxnId txnId, @Nonnull Timestamp executeAt, 
@Nonnull SummaryStatus status, IsDep dep, Unseekables<?> participants)
         {
-            this.txnId = txnId;
-            this.executeAt = executeAt;
-            this.status = status;
+            super(txnId);
             this.participants = participants;
-            this.findAsDep = findAsDep;
-            this.dep = dep;
+            this.executeAt = executeAt.equals(txnId) ? this : executeAt;
+            this.encoded = status.ordinal() | (dep == null ? Integer.MIN_VALUE 
: (dep.ordinal() << IS_DEP_SHIFT));
+        }
+
+        private Summary(@Nonnull TxnId txnId, @Nonnull Timestamp executeAt, 
int encoded, Unseekables<?> participants)
+        {
+            super(txnId);
+            this.participants = participants;
+            this.executeAt = executeAt == txnId || executeAt.equals(txnId) ? 
this : executeAt;
+            this.encoded = encoded;
+        }
+
+        public boolean is(IsDep isDep)
+        {
+            return (encoded >> IS_DEP_SHIFT) == isDep.ordinal();
         }
 
-        public Summary slice(Ranges slice)
+        public IsDep isDep()
         {
-            return new Summary(txnId, executeAt, status, 
participants.slice(slice, Minimal), dep, findAsDep);
+            int ordinal = encoded >> IS_DEP_SHIFT;

Review Comment:
   Ok, I get it. Have pushed a change.



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to