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


##########
accord-core/src/main/java/accord/coordinate/CollectLatestDeps.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package accord.coordinate;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.BiConsumer;
+
+import accord.api.RoutingKey;
+import accord.coordinate.tracking.QuorumTracker;
+import accord.local.CommandStore;
+import accord.local.Node;
+import accord.local.Node.Id;
+import accord.messages.Callback;
+import accord.messages.GetLatestDeps;
+import accord.messages.GetLatestDeps.GetLatestDepsOk;
+import accord.primitives.FullRoute;
+import accord.primitives.LatestDeps;
+import accord.primitives.Timestamp;
+import accord.primitives.TxnId;
+import accord.primitives.Unseekables;
+import accord.topology.Topologies;
+import accord.utils.SortedArrays.SortedArrayList;
+import accord.utils.SortedListMap;
+
+import static accord.coordinate.tracking.RequestStatus.Failed;
+import static accord.coordinate.tracking.RequestStatus.Success;
+
+public class CollectLatestDeps implements Callback<GetLatestDepsOk>
+{
+    final Node node;
+    final TxnId txnId;
+    final RoutingKey homeKey;
+    final Timestamp executeAt;
+
+    private final SortedListMap<Id, GetLatestDepsOk> oks;

Review Comment:
   It isn't, this is just an efficient and debuggable map when you already have 
a sorted list of keys (which we have via topologies). You just need an array of 
the same size for storing the values. The alternative is a plain list, but this 
is not debuggable as it loses the source node id. I think it is a nice balance 
of clarity and efficiency, though I'll grant it might be nice in future to 
introduce an immutable hash collection that could be used to index an array of 
values.



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