ascherbakoff commented on code in PR #6007: URL: https://github.com/apache/ignite-3/pull/6007#discussion_r2157075051
########## modules/client/src/main/java/org/apache/ignite/internal/client/table/PartitionAwarenessProvider.java: ########## @@ -17,45 +17,42 @@ package org.apache.ignite.internal.client.table; -import java.util.function.BiFunction; +import java.util.function.Function; import org.jetbrains.annotations.Nullable; /** * Partition awareness provider. - * Represents 3 use cases: - * 1. Partition awareness is enabled. Use hashFunc to determine partition. - * 2. Transaction is used. Use specific channel. - * 3. Null instance = No partition awareness and no transaction. Use any channel. + * Used to calculate a partition for a specific operation. */ public class PartitionAwarenessProvider { - private final @Nullable Integer partition; + static PartitionAwarenessProvider NULL_PROVIDER = of((Integer) null); - private final @Nullable BiFunction<ClientSchema, Boolean, Integer> hashFunc; + private final @Nullable Integer partition; - private PartitionAwarenessProvider(@Nullable BiFunction<ClientSchema, Boolean, Integer> hashFunc, @Nullable Integer partition) { - assert hashFunc != null ^ partition != null; + private final @Nullable Function<ClientSchema, Integer> hashFunc; + private PartitionAwarenessProvider(@Nullable Function<ClientSchema, Integer> hashFunc, @Nullable Integer partition) { this.hashFunc = hashFunc; this.partition = partition; } - public static PartitionAwarenessProvider of(Integer partition) { + public static PartitionAwarenessProvider of(@Nullable Integer partition) { Review Comment: 🆗 -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org