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


##########
accord-core/src/main/java/accord/messages/Apply.java:
##########
@@ -54,15 +63,59 @@ public Apply(Node.Id to, Topologies topologies, TxnId 
txnId, Txn txn, Key homeKe
         this.result = result;
     }
 
+    @VisibleForImplementation
+    public Apply(Keys scope, long waitForEpoch, TxnId txnId, Txn txn, Key 
homeKey, Timestamp executeAt, Deps deps, Writes writes, Result result)
+    {
+        super(scope, waitForEpoch);
+        this.txnId = txnId;
+        this.txn = txn;
+        this.homeKey = homeKey;
+        this.executeAt = executeAt;
+        this.deps = deps;
+        this.writes = writes;
+        this.result = result;
+    }
+
+    static Future<Void> waitAndReduce(Future<Void> left, Future<Void> right)

Review Comment:
   In this example, I don't think we need to invoke a callback at all in 
`postApply`. There's no need for the caller to be informed when `Apply` 
completes - only execute? There might be some error handling to perform in the 
case that apply later fails, but why are we informing the caller about apply 
here?
   
   But, leaving that aside, I don't really see the problem? Each method has its 
own responsibility - if we need to scope it better, we can create a new 
callback for the relevant scope, that translates the semantics (as we do for 
`Future`). But I don't see any additional safety - the `Future` we return is 
just as prone to being done incorrectly at each step? If anything, to me this 
just highlights additional efficiencies of callbacks, as we _can_ quite safely 
pass them down without allocating additional objects.
   
   This is exactly what we do for coordination, we pass through the callback 
until either we hit an exception or we pass responsibility of the callback 
onwards.



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