timoninmaxim commented on code in PR #12783:
URL: https://github.com/apache/ignite/pull/12783#discussion_r2962142671


##########
modules/core/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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 org.apache.ignite.client;
+
+import java.io.Serializable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/** Affinity configuration for default (rendezvous) affinity function. */
+public final class ClientAffinityConfiguration implements Serializable {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** @serial Total number of partitions. */
+    private int partitions = -1;
+
+    /** @serial Flag to exclude same-host-neighbors from being backups of each 
other. */
+    private boolean excludeNeighbors;
+
+    /** Default constructor. */
+    public ClientAffinityConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Gets total number of partitions.
+     *
+     * @return Total number of partitions.
+     */
+    public int getPartitions() {
+        return partitions;
+    }
+
+    /**
+     * Sets total number of partitions.
+     *
+     * @param partitions Total number of partitions.
+     * @return {@code this} for chaining.
+     */
+    public ClientAffinityConfiguration setPartitions(int partitions) {
+        this.partitions = partitions;

Review Comment:
   Let's add fail fast check here `A.ensure(partitions > 0)`



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheConfigurationSerializer.java:
##########
@@ -226,6 +232,13 @@ static void write(BinaryWriterEx writer, 
CacheConfiguration cfg, ClientProtocolC
             writer.writeString(cfg.getIndexPath());
         }
 
+        if 
(protocolCtx.isFeatureSupported(ClientBitmaskFeature.CACHE_AFFINITY_CFG)) {
+            AffinityFunction aff = cfg.getAffinity();
+            writer.writeInt(aff == null ? -1 : aff.partitions());

Review Comment:
   Let's check for RendevouzAffinityFunction both parameters



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