Class GridAffinityFunctionContextImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContextImpl
-
- All Implemented Interfaces:
AffinityFunctionContext
public class GridAffinityFunctionContextImpl extends Object implements AffinityFunctionContext
Cache affinity function context implementation. Simple bean that holds all required fields.
-
-
Constructor Summary
Constructors Constructor Description GridAffinityFunctionContextImpl(List<ClusterNode> topSnapshot, List<List<ClusterNode>> prevAssignment, DiscoveryEvent discoEvt, @NotNull AffinityTopologyVersion topVer, int backups)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intbackups()Gets number of backups for new assignment.List<ClusterNode>currentTopologySnapshot()Gets current topology snapshot.AffinityTopologyVersioncurrentTopologyVersion()Gets current topology version number.@Nullable DiscoveryEventdiscoveryEvent()Gets discovery event caused topology change.List<List<ClusterNode>>prevAssignment()Gets the previous assignment.@Nullable List<ClusterNode>previousAssignment(int part)Gets affinity assignment for given partition on previous topology version.
-
-
-
Constructor Detail
-
GridAffinityFunctionContextImpl
public GridAffinityFunctionContextImpl(List<ClusterNode> topSnapshot, List<List<ClusterNode>> prevAssignment, DiscoveryEvent discoEvt, @NotNull @NotNull AffinityTopologyVersion topVer, int backups)
- Parameters:
topSnapshot- Topology snapshot.topVer- Topology version.
-
-
Method Detail
-
previousAssignment
@Nullable public @Nullable List<ClusterNode> previousAssignment(int part)
Gets affinity assignment for given partition on previous topology version. First node in returned list is a primary node, other nodes are backups.- Specified by:
previousAssignmentin interfaceAffinityFunctionContext- Parameters:
part- Partition to get previous assignment for.- Returns:
- List of nodes assigned to given partition on previous topology version or
nullif this information is not available.
-
currentTopologySnapshot
public List<ClusterNode> currentTopologySnapshot()
Gets current topology snapshot. Snapshot will contain only nodes on which particular cache is configured. List of passed nodes is guaranteed to be sorted in a same order on all nodes on which partition assignment is performed.- Specified by:
currentTopologySnapshotin interfaceAffinityFunctionContext- Returns:
- Cache topology snapshot.
-
currentTopologyVersion
public AffinityTopologyVersion currentTopologyVersion()
Gets current topology version number.- Specified by:
currentTopologyVersionin interfaceAffinityFunctionContext- Returns:
- Current topology version number.
-
discoveryEvent
@Nullable public @Nullable DiscoveryEvent discoveryEvent()
Gets discovery event caused topology change.- Specified by:
discoveryEventin interfaceAffinityFunctionContext- Returns:
- Discovery event caused latest topology change or
nullif this information is not available.
-
backups
public int backups()
Gets number of backups for new assignment.- Specified by:
backupsin interfaceAffinityFunctionContext- Returns:
- Number of backups for new assignment.
-
prevAssignment
public List<List<ClusterNode>> prevAssignment()
Gets the previous assignment.- Returns:
- Previous assignment
-
-