Class ClientCacheAffinityContext
- java.lang.Object
-
- org.apache.ignite.internal.client.thin.ClientCacheAffinityContext
-
public class ClientCacheAffinityContext extends Object
Client cache partition awareness context.
-
-
Constructor Summary
Constructors Constructor Description ClientCacheAffinityContext(IgniteBinary binary, @Nullable ClientPartitionAwarenessMapperFactory factory, Predicate<UUID> connectionEstablishedPredicate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UUIDaffinityNode(int cacheId, int part)Calculates affinity node for given cache and partition.UUIDaffinityNode(int cacheId, Object key)Calculates affinity node for given cache and key.booleanaffinityUpdateRequired(int cacheId)Is affinity update required for given cache.protected ClientCacheAffinityMappingcurrentMapping()Current affinity mapping.org.apache.ignite.internal.client.thin.ClientCacheAffinityContext.TopologyNodeslastTopology()Gets last topology information.booleanreadPartitionsUpdateResponse(org.apache.ignite.internal.client.thin.PayloadInputChannel ch)voidregisterCache(String cacheName)voidreset(org.apache.ignite.internal.client.thin.ClientCacheAffinityContext.TopologyNodes top)Resets affinity context.voidunregisterCache(String cacheName)booleanupdateLastTopologyVersion(AffinityTopologyVersion topVer, UUID nodeId)Update topology version if it's greater than current version and store nodes for last topology.voidwritePartitionsUpdateRequest(org.apache.ignite.internal.client.thin.PayloadOutputChannel ch)
-
-
-
Constructor Detail
-
ClientCacheAffinityContext
public ClientCacheAffinityContext(IgniteBinary binary, @Nullable @Nullable ClientPartitionAwarenessMapperFactory factory, Predicate<UUID> connectionEstablishedPredicate)
- Parameters:
binary- Binary data processor.factory- Factory for caches with custom affinity.
-
-
Method Detail
-
updateLastTopologyVersion
public boolean updateLastTopologyVersion(AffinityTopologyVersion topVer, UUID nodeId)
Update topology version if it's greater than current version and store nodes for last topology.- Parameters:
topVer- Topology version.nodeId- Node id.- Returns:
Trueif last topology was updated to the new version.
-
affinityUpdateRequired
public boolean affinityUpdateRequired(int cacheId)
Is affinity update required for given cache.- Parameters:
cacheId- Cache id.
-
writePartitionsUpdateRequest
public void writePartitionsUpdateRequest(org.apache.ignite.internal.client.thin.PayloadOutputChannel ch)
- Parameters:
ch- Payload output channel.
-
readPartitionsUpdateResponse
public boolean readPartitionsUpdateResponse(org.apache.ignite.internal.client.thin.PayloadInputChannel ch)
- Parameters:
ch- Payload input channel.
-
lastTopology
public org.apache.ignite.internal.client.thin.ClientCacheAffinityContext.TopologyNodes lastTopology()
Gets last topology information.
-
reset
public void reset(org.apache.ignite.internal.client.thin.ClientCacheAffinityContext.TopologyNodes top)
Resets affinity context.- Parameters:
top- Topology which triggers reset.
-
affinityNode
public UUID affinityNode(int cacheId, Object key)
Calculates affinity node for given cache and key.- Parameters:
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.
-
currentMapping
protected ClientCacheAffinityMapping currentMapping()
Current affinity mapping.
-
registerCache
public void registerCache(String cacheName)
- Parameters:
cacheName- Cache name.
-
unregisterCache
public void unregisterCache(String cacheName)
- Parameters:
cacheName- Cache name.
-
-