belliottsmith commented on code in PR #6: URL: https://github.com/apache/cassandra-accord/pull/6#discussion_r937093480
########## 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: I am a strong believer in using minimal functionality. Futures are actually pretty heavy-weight and complex objects. Here we are passing a single callback through the entire hierarchy of commands, with each one either invoking it (and terminating) or passing it on to another for responsibility. We save memory, CPU time, and it is also cleaner. We could plausibly pass a Future through the chain to be completed, but we're still ultimately registering precisely one callback, so we're just introducing an entirely unnecessary intermediate object. If you would like to, I would be OK with introducing an `AtMostOnceCallback` object, that guards Callbacks to ensure they're invoked at most once, as this would be relatively lightweight, and keeps the intent and control flow pretty much as simple and straightforward. But I think it is fine either way. -- 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]

