isapego commented on code in PR #7467:
URL: https://github.com/apache/ignite-3/pull/7467#discussion_r2721243953


##########
modules/platforms/dotnet/Apache.Ignite/Table/IPartitionDistribution.cs:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Table;
+
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
+using Internal.Table.Serialization;
+using Mapper;
+using Network;
+
+/// <summary>
+/// Partition distribution provides table partition information.
+/// This interface can be used to get all partitions of a table, the location 
of the primary replica of a partition,
+/// the partition for a specific table key.
+/// </summary>
+public interface IPartitionDistribution
+{
+    /// <summary>
+    /// Gets the primary replicas for all partitions.
+    /// <para />
+    /// NOTE: Prefer <see cref="GetPrimaryReplicaAsync"/> for 
performance-critical code.
+    /// </summary>
+    /// <returns>Map of partition to the primary replica node.</returns>
+    ValueTask<IReadOnlyDictionary<IPartition, IClusterNode>> 
GetPrimaryReplicasAsync();
+
+    /// <summary>
+    /// Gets all partitions hosted by the specified node as a primary replica 
as of the time of the call.
+    /// <para />
+    /// NOTE: This assignment may become outdated if a re-assignment happens 
on the cluster.
+    /// </summary>
+    /// <param name="node">Cluster node.</param>
+    /// <returns>A task representing the asynchronous operation with a list of 
all partitions hosted by the specified node
+    /// as a primary replica.</returns>
+    ValueTask<IReadOnlyList<IPartition>> GetPrimaryReplicasAsync(IClusterNode 
node);
+
+    /// <summary>
+    /// Gets the primary replica for the specified partition.
+    /// <para />
+    /// NOTE: Prefer this method over <see cref="GetPrimaryReplicasAsync()"/> 
for performance-critical code.
+    /// </summary>
+    /// <param name="partition">Partition.</param>
+    /// <returns>Primary replica.</returns>
+    ValueTask<IClusterNode> GetPrimaryReplicaAsync(IPartition partition);
+
+    /// <summary>
+    /// Gets the partition for the specified table key.
+    /// </summary>
+    /// <param name="tuple">Table key tuple.</param>

Review Comment:
   I wonder should we specify if it's OK for the tuple to have non-key fields 
in cases like this?



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

Reply via email to