public class GridAffinityAssignmentCache extends Object
| Constructor and Description |
|---|
GridAffinityAssignmentCache(GridCacheContext ctx,
String cacheName,
AffinityFunction aff,
AffinityKeyMapper affMapper,
int backups)
Constructs affinity cached calculations.
|
| Modifier and Type | Method and Description |
|---|---|
List<List<ClusterNode>> |
assignments(AffinityTopologyVersion topVer) |
Set<Integer> |
backupPartitions(UUID nodeId,
AffinityTopologyVersion topVer)
Get backup partitions for specified node ID.
|
List<List<ClusterNode>> |
calculate(AffinityTopologyVersion topVer,
DiscoveryEvent discoEvt)
Calculates affinity cache for given topology version.
|
void |
cleanUpCache(AffinityTopologyVersion topVer)
Clean up outdated cache items.
|
void |
initialize(AffinityTopologyVersion topVer,
List<List<ClusterNode>> affAssignment)
Initializes affinity with given topology version and assignment.
|
AffinityTopologyVersion |
lastVersion() |
List<ClusterNode> |
nodes(int part,
AffinityTopologyVersion 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,
AffinityTopologyVersion topVer)
Get primary partitions for specified node ID.
|
IgniteInternalFuture<AffinityTopologyVersion> |
readyFuture(AffinityTopologyVersion topVer)
Gets future that will be completed after topology with version
topVer is calculated. |
public GridAffinityAssignmentCache(GridCacheContext ctx, String cacheName, AffinityFunction aff, AffinityKeyMapper affMapper, int backups)
ctx - Kernal context.cacheName - Cache name.aff - Affinity function.affMapper - Affinity key mapper.backups - Number of backups.public void initialize(AffinityTopologyVersion topVer, List<List<ClusterNode>> affAssignment)
topVer - Topology version.affAssignment - Affinity assignment for topology version.public void onKernalStop()
public List<List<ClusterNode>> calculate(AffinityTopologyVersion topVer, DiscoveryEvent discoEvt)
topVer - Topology version to calculate affinity cache for.discoEvt - Discovery event that caused this topology version change.public AffinityTopologyVersion lastVersion()
public void cleanUpCache(AffinityTopologyVersion topVer)
topVer - Actual topology version, older versions will be removed.public List<List<ClusterNode>> assignments(AffinityTopologyVersion topVer)
topVer - Topology version.@Nullable public IgniteInternalFuture<AffinityTopologyVersion> readyFuture(AffinityTopologyVersion 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, AffinityTopologyVersion topVer)
part - Partition.topVer - Topology version.public Set<Integer> primaryPartitions(UUID nodeId, AffinityTopologyVersion topVer)
nodeId - Node ID to get primary partitions for.topVer - Topology version.public Set<Integer> backupPartitions(UUID nodeId, AffinityTopologyVersion topVer)
nodeId - Node ID to get backup partitions for.topVer - Topology version.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.1.0-incubating Release Date : May 20 2015