public class GridAffinityAssignmentCache extends Object
| Constructor and Description |
|---|
GridAffinityAssignmentCache(GridCacheContext ctx,
String cacheName,
CacheAffinityFunction aff,
CacheAffinityKeyMapper affMapper,
int backups)
Constructs affinity cached calculations.
|
| Modifier and Type | Method and Description |
|---|---|
List<List<ClusterNode>> |
assignments(long topVer) |
Set<Integer> |
backupPartitions(UUID nodeId,
long topVer)
Get backup partitions for specified node ID.
|
List<List<ClusterNode>> |
calculate(long topVer,
DiscoveryEvent discoEvt)
Calculates affinity cache for given topology version.
|
void |
cleanUpCache(long topVer)
Clean up outdated cache items.
|
void |
initialize(long topVer,
List<List<ClusterNode>> affAssignment)
Initializes affinity with given topology version and assignment.
|
long |
lastVersion() |
List<ClusterNode> |
nodes(int part,
long topVer)
Gets affinity nodes for specified partition.
|
void |
onKernalStop()
Kernal stop callback.
|
int |
partition(Object key)
NOTE: Use this method always when you need to calculate partition id for
a key provided by user.
|
int |
partitions() |
Set<Integer> |
primaryPartitions(UUID nodeId,
long topVer)
Get primary partitions for specified node ID.
|
IgniteInternalFuture<Long> |
readyFuture(long topVer)
Gets future that will be completed after topology with version
topVer is calculated. |
public GridAffinityAssignmentCache(GridCacheContext ctx, String cacheName, CacheAffinityFunction aff, CacheAffinityKeyMapper affMapper, int backups)
ctx - Kernal context.cacheName - Cache name.aff - Affinity function.affMapper - Affinity key mapper.backups - Number of backups.public void initialize(long topVer,
List<List<ClusterNode>> affAssignment)
topVer - Topology version.affAssignment - Affinity assignment for topology version.public void onKernalStop()
public List<List<ClusterNode>> calculate(long topVer, DiscoveryEvent discoEvt)
topVer - Topology version to calculate affinity cache for.discoEvt - Discovery event that caused this topology version change.public long lastVersion()
public void cleanUpCache(long topVer)
topVer - Actual topology version, older versions will be removed.public List<List<ClusterNode>> assignments(long topVer)
topVer - Topology version.@Nullable public IgniteInternalFuture<Long> readyFuture(long topVer)
topVer is calculated.topVer - Topology version to await for.topVer is calculated.public int partitions()
public int partition(Object key)
key - Key.public List<ClusterNode> nodes(int part, long topVer)
part - Partition.topVer - Topology version.public Set<Integer> primaryPartitions(UUID nodeId, long topVer)
nodeId - Node ID to get primary partitions for.topVer - Topology version.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015