public class GridAffinityAssignmentCache extends Object
| Constructor and Description |
|---|
GridAffinityAssignmentCache(GridCacheContext ctx,
String cacheName,
GridCacheAffinityFunction aff,
GridCacheAffinityKeyMapper affMapper,
int backups)
Constructs affinity cached calculations.
|
| Modifier and Type | Method and Description |
|---|---|
List<List<GridNode>> |
assignments(long topVer) |
Set<Integer> |
backupPartitions(UUID nodeId,
long topVer)
Get backup partitions for specified node ID.
|
List<List<GridNode>> |
calculate(long topVer,
GridDiscoveryEvent discoEvt)
Calculates affinity cache for given topology version.
|
void |
cleanUpCache(long topVer)
Clean up outdated cache items.
|
void |
initialize(long topVer,
List<List<GridNode>> affAssignment)
Initializes affinity with given topology version and assignment.
|
long |
lastVersion() |
Collection<GridNode> |
nodes(int part,
long topVer)
Gets affinity nodes for specified partition.
|
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.
|
GridFuture<Long> |
readyFuture(long topVer)
Gets future that will be completed after topology with version
topVer is calculated. |
public GridAffinityAssignmentCache(GridCacheContext ctx, String cacheName, GridCacheAffinityFunction aff, GridCacheAffinityKeyMapper affMapper, int backups)
ctx - Kernal context.cacheName - Cache name.aff - Affinity function.affMapper - Affinity key mapper.public void initialize(long topVer,
List<List<GridNode>> affAssignment)
topVer - Topology version.affAssignment - Affinity assignment for topology version.public List<List<GridNode>> calculate(long topVer, GridDiscoveryEvent 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<GridNode>> assignments(long topVer)
topVer - Topology version.public GridFuture<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 Collection<GridNode> 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.Copyright © 2014. All rights reserved.