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


##########
accord-core/src/main/java/accord/messages/AbstractEpochRequest.java:
##########
@@ -0,0 +1,58 @@
+package accord.messages;
+
+import accord.api.Key;
+import accord.local.Node;
+import accord.local.PreLoadContext;
+import accord.local.SafeCommandStore;
+import accord.primitives.TxnId;
+import accord.utils.MapReduceConsume;
+
+import java.util.Collections;
+
+public abstract class AbstractEpochRequest<R extends Reply> implements 
PreLoadContext, EpochRequest, MapReduceConsume<SafeCommandStore, R>
+{
+    public final TxnId txnId;
+    protected transient Node node;
+    protected transient Node.Id replyTo;
+    protected transient ReplyContext replyContext;
+
+    protected AbstractEpochRequest(TxnId txnId)
+    {
+        this.txnId = txnId;
+    }
+
+    @Override
+    public void process(Node on, Node.Id replyTo, ReplyContext replyContext)
+    {
+        this.node = on;
+        this.replyTo = replyTo;
+        this.replyContext = replyContext;
+        process();
+    }
+
+    protected abstract void process();
+
+    @Override
+    public R reduce(R o1, R o2)

Review Comment:
   In this case we would need a `MapConsume` implementation, and dedicated 
additional methods we can pass such a disjoint type to. In this case, also, 
it's not that we don't _need_ them but that there should be _at most one 
match_. So invoking `reduce` is a literal bug. I'm not convinced it is simpler 
to introduce dedicated `MapConsume` methods, particularly since some 
implementations in this hierarchy do expect multiple matches.



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