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


##########
accord-core/src/main/java/accord/messages/Callback.java:
##########
@@ -9,5 +9,7 @@
 public interface Callback<T>
 {
     void onSuccess(Id from, T response);
-    void onFailure(Id from, Throwable throwable);
+    default void onSlowResponse(Id from) {}
+    void onFailure(Id from, Throwable failure);
+    void onCallbackFailure(Throwable failure);

Review Comment:
   can we add `Id from` to be consistent?  Every call path I see knows `from`.
   
   As far as I can see the only places that call this are tests, and they have 
a different pattern than the rest of the code...
   
   src/main
   
   ```
   callback.onSuccess(from, response);
   ```
   
   src/test
   
   ```
   try
   {
     callback.onSuccess(from, response);
   }
   catch (Throwable t)
   {
     callback.onCallbackFailure(t);
   }
   ```
   
   What is the reason for the divergence?  



##########
accord-core/src/main/java/accord/api/Key.java:
##########
@@ -3,10 +3,7 @@
 /**
  * A routing key for determining which shards are involved in a transaction
  */
-public interface Key<K extends Key<K>> extends Comparable<K>
+public interface Key<K extends Key<K>> extends RoutingKey<K>
 {
-    /**
-     * Returns a hash code of a key to support accord internal sharding. Hash 
values for equal keys must be equal.
-     */
-    int keyHash();
+    Key toRoutingKey();

Review Comment:
   `Key` is generic, should this be `K` instead?  Also what is the reasoning 
behind moving `keyHash` to a new `RoutingKey` and adding a method to return 
that type?  
   
   As far as I can see `toRoutingKey` is dead code?  I don't find anything that 
calls it



##########
accord-core/src/main/java/accord/api/Query.java:
##########
@@ -9,5 +9,5 @@
      * Perform some transformation on the complete {@link Data} result of a 
{@link Read}
      * from some {@link DataStore}, to produce a {@link Result} to return to 
the client.
      */
-    Result compute(Data data);
+    Result compute(Data data, Read read, Update update);

Review Comment:
   should `Update` have the `Nullable` annotation?  It is nullable on read-only 
queries



##########
accord-core/src/main/java/accord/coordinate/Execute.java:
##########
@@ -1,88 +1,78 @@
 package accord.coordinate;
 
 import java.util.Set;
+import java.util.function.BiConsumer;
 
 import accord.api.Data;
 import accord.api.Key;
 import accord.coordinate.tracking.ReadTracker;
 import accord.api.Result;
 import accord.messages.Callback;
 import accord.local.Node;
+import accord.primitives.Timestamp;
+import accord.primitives.TxnId;
 import accord.topology.Topologies;
 import accord.txn.*;
 import accord.messages.ReadData.ReadReply;
-import accord.txn.Dependencies;
+import accord.primitives.Deps;
 import accord.local.Node.Id;
 import accord.messages.Commit;
 import accord.messages.ReadData;
 import accord.messages.ReadData.ReadOk;
-import org.apache.cassandra.utils.concurrent.AsyncPromise;
-import org.apache.cassandra.utils.concurrent.Future;
 
-class Execute extends AsyncPromise<Result> implements Callback<ReadReply>
+class Execute implements Callback<ReadReply>

Review Comment:
   Why move away from Promise/Future in favor of Callback?  With futures we 
know that setting can only happen once, but now we need to worry about calling 
callback multiple times or hoping the callback maps to a future to deal with 
that.



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