Class ClientCacheAffinityMapping
- java.lang.Object
-
- org.apache.ignite.internal.client.thin.ClientCacheAffinityMapping
-
public class ClientCacheAffinityMapping extends Object
Affinity mapping (partition to nodes) for each cache.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UUIDaffinityNode(int cacheId, int part)Calculates affinity node for given cache and partition.UUIDaffinityNode(IgniteBinary binary, int cacheId, Object key)Calculates affinity node for given cache and key.Collection<Integer>cacheIds()Gets cache IDs.static ClientCacheAffinityMappingmerge(ClientCacheAffinityMapping... mappings)Merge specified mappings into one instance.static ClientCacheAffinityMappingreadResponse(org.apache.ignite.internal.client.thin.PayloadInputChannel ch, Function<Integer,Function<Integer,ClientPartitionAwarenessMapper>> mappers)Reads caches affinity response from the input channel and createsClientCacheAffinityMappinginstance from this response.AffinityTopologyVersiontopologyVersion()Gets topology version.static voidwriteRequest(org.apache.ignite.internal.client.thin.PayloadOutputChannel ch, Collection<Integer> cacheIds, boolean customMappingsRequired)Writes caches affinity request to the output channel.
-
-
-
Method Detail
-
topologyVersion
public AffinityTopologyVersion topologyVersion()
Gets topology version.
-
cacheIds
public Collection<Integer> cacheIds()
Gets cache IDs.
-
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
nullif 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
nullif affinity node can't be determined for given cache and partition.
-
merge
public static ClientCacheAffinityMapping merge(ClientCacheAffinityMapping... mappings)
Merge specified mappings into one instance.
-
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-trueif 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 createsClientCacheAffinityMappinginstance from this response.- Parameters:
ch- Input channel.mappers- Function that produces key mapping functions.
-
-