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


##########
accord-core/src/main/java/accord/local/KeyHistory.java:
##########
@@ -48,7 +49,33 @@ public enum KeyHistory
     /**
      * Load recovery information for all keys into memory before processing 
the command.
      */
-    RECOVER,
+    RECOVER;
+    
+    public boolean satisfiesIfPresent(KeyHistory that)
+    {
+        return satisfies(that, ASYNC);
+    }
+
+    public boolean satisfies(KeyHistory that)
+    {
+        return satisfies(that, SYNC);
+    }
+
+    private boolean satisfies(KeyHistory that, KeyHistory ifSyncRequireAtLeast)
+    {
+        switch (that)
+        {
+            default: throw new AssertionError("Unhandled KeyHistory: " + that);
+            case NONE:
+                return true;
+            case RECOVER:
+            case TIMESTAMPS:
+                return this == that;
+            case ASYNC:
+            case INCR:
+            case SYNC:
+                return this.compareTo(ifSyncRequireAtLeast) >= 0;

Review Comment:
   so for `satisfies` (only method used in this PR) this is only true for 
`SYNC` and `RECOVER`?  `ASYNC`, `INCR`, and `SYNC` are all new to me, so need 
to catch up on the recent changes to better understand this change.



##########
accord-core/src/main/java/accord/utils/CheckpointIntervalArray.java:
##########
@@ -216,4 +217,34 @@ else if ((ri & BIT29) != 0)
         forEachRange.accept(p1, p2, p3, p4, start, end);
         return end;
     }
+
+    @Inline
+    public <P1, P2, P3, P4> int forEachKey(Key key, IndexedQuadConsumer<P1, 
P2, P3, P4> forEachScanOrCheckpoint, IndexedRangeQuadConsumer<P1, P2, P3, P4> 
forEachRange, P1 p1, P2 p2, P3 p3, P4 p4, int minIndex)

Review Comment:
   why `Key` vs `RoutableKey`?  I don't directly see `Key` class being used, so 
curious on the intent



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