Class ClientCacheAffinityMapping


  • public class ClientCacheAffinityMapping
    extends Object
    Affinity mapping (partition to nodes) for each cache.
    • Method Detail

      • affinityNode

        public UUID affinityNode​(IgniteBinary binary,
                                 int cacheId,
                                 Object key)
        Calculates affinity node for given cache and key.
        Parameters:
        binary - Binary data processor (needed to extract affinity field from the key).
        cacheId - Cache ID.
        key - Key.
        Returns:
        Affinity node id or null if affinity node can't be determined for given cache and key.
      • affinityNode

        public UUID affinityNode​(int cacheId,
                                 int part)
        Calculates affinity node for given cache and partition.
        Parameters:
        cacheId - Cache ID.
        part - Partition.
        Returns:
        Affinity node id or null if affinity node can't be determined for given cache and partition.
      • writeRequest

        public static void writeRequest​(org.apache.ignite.internal.client.thin.PayloadOutputChannel ch,
                                        Collection<Integer> cacheIds,
                                        boolean customMappingsRequired)
        Writes caches affinity request to the output channel.
        Parameters:
        ch - Output channel.
        cacheIds - Set of cache ids to request.
        customMappingsRequired - true if non-default affinity mappings required.
      • readResponse

        public static ClientCacheAffinityMapping readResponse​(org.apache.ignite.internal.client.thin.PayloadInputChannel ch,
                                                              Function<Integer,​Function<Integer,​ClientPartitionAwarenessMapper>> mappers)
        Reads caches affinity response from the input channel and creates ClientCacheAffinityMapping instance from this response.
        Parameters:
        ch - Input channel.
        mappers - Function that produces key mapping functions.