Class GridAffinityAssignmentV2
- java.lang.Object
-
- org.apache.ignite.internal.dto.IgniteDataTransferObject
-
- org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentV2
-
- All Implemented Interfaces:
Externalizable,Serializable,AffinityAssignment
public class GridAffinityAssignmentV2 extends IgniteDataTransferObject implements AffinityAssignment
Cached affinity calculations V2. It supports adaptive usage of BitSets instead of HashSets.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.dto.IgniteDataTransferObject
V1, V2, V3, V4, V5, V6, V7, V8, V9
-
Fields inherited from interface org.apache.ignite.internal.processors.affinity.AffinityAssignment
DFLT_AFFINITY_BACKUPS_THRESHOLD, IGNITE_AFFINITY_BACKUPS_THRESHOLD, IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION
-
-
Constructor Summary
Constructors Constructor Description GridAffinityAssignmentV2()Default constructor for deserialization.GridAffinityAssignmentV2(AffinityTopologyVersion topVer, List<List<ClusterNode>> assignment, List<List<ClusterNode>> idealAssignment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<List<ClusterNode>>assignment()Set<Integer>backupPartitions(UUID nodeId)Get backup partitions for specified node ID.booleanequals(Object o)List<ClusterNode>get(int part)Get affinity nodes for partition.Collection<UUID>getIds(int part)Get affinity node IDs for partition as unmodifiable collection.inthashCode()List<List<ClusterNode>>idealAssignment()Set<ClusterNode>nodes()Set<Integer>partitionPrimariesDifferentToIdeal()Set<ClusterNode>primaryPartitionNodes()Set<Integer>primaryPartitions(UUID nodeId)Get primary partitions for specified node ID.protected voidreadExternalData(byte protoVer, ObjectInput in)Load object's specific data content.AffinityTopologyVersiontopologyVersion()StringtoString()protected voidwriteExternalData(ObjectOutput out)Save object's specific data content.-
Methods inherited from class org.apache.ignite.internal.dto.IgniteDataTransferObject
getProtocolVersion, readExternal, toList, toSet, writeExternal
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.affinity.AffinityAssignment
assignments2ids
-
-
-
-
Constructor Detail
-
GridAffinityAssignmentV2
public GridAffinityAssignmentV2()
Default constructor for deserialization.
-
GridAffinityAssignmentV2
public GridAffinityAssignmentV2(AffinityTopologyVersion topVer, List<List<ClusterNode>> assignment, List<List<ClusterNode>> idealAssignment)
- Parameters:
topVer- Topology version.assignment- Assignment.idealAssignment- Ideal assignment.
-
-
Method Detail
-
idealAssignment
public List<List<ClusterNode>> idealAssignment()
- Specified by:
idealAssignmentin interfaceAffinityAssignment- Returns:
- Unmodifiable ideal affinity assignment computed by affinity function.
-
assignment
public List<List<ClusterNode>> assignment()
- Specified by:
assignmentin interfaceAffinityAssignment- Returns:
- Unmodifiable affinity assignment.
-
topologyVersion
public AffinityTopologyVersion topologyVersion()
- Specified by:
topologyVersionin interfaceAffinityAssignment- Returns:
- Topology version.
-
get
public List<ClusterNode> get(int part)
Get affinity nodes for partition.- Specified by:
getin interfaceAffinityAssignment- Parameters:
part- Partition.- Returns:
- Affinity nodes.
-
getIds
public Collection<UUID> getIds(int part)
Get affinity node IDs for partition as unmodifiable collection. Depending on AFFINITY_BACKUPS_THRESHOLD we returned newly allocated HashSet or view on List.- Specified by:
getIdsin interfaceAffinityAssignment- Parameters:
part- Partition.- Returns:
- Affinity nodes IDs.
-
nodes
public Set<ClusterNode> nodes()
- Specified by:
nodesin interfaceAffinityAssignment- Returns:
- Nodes having primary and backup assignments.
-
primaryPartitionNodes
public Set<ClusterNode> primaryPartitionNodes()
- Specified by:
primaryPartitionNodesin interfaceAffinityAssignment- Returns:
- Nodes having primary partitions assignments.
-
primaryPartitions
public Set<Integer> primaryPartitions(UUID nodeId)
Get primary partitions for specified node ID.- Specified by:
primaryPartitionsin interfaceAffinityAssignment- Parameters:
nodeId- Node ID to get primary partitions for.- Returns:
- Primary partitions for specified node ID.
-
backupPartitions
public Set<Integer> backupPartitions(UUID nodeId)
Get backup partitions for specified node ID.- Specified by:
backupPartitionsin interfaceAffinityAssignment- Parameters:
nodeId- Node ID to get backup partitions for.- Returns:
- Backup partitions for specified node ID.
-
partitionPrimariesDifferentToIdeal
public Set<Integer> partitionPrimariesDifferentToIdeal()
- Specified by:
partitionPrimariesDifferentToIdealin interfaceAffinityAssignment- Returns:
- Set of partitions which primary is different to primary in ideal assignment.
-
writeExternalData
protected void writeExternalData(ObjectOutput out) throws IOException
Save object's specific data content.- Specified by:
writeExternalDatain classIgniteDataTransferObject- Parameters:
out- Output object to write data content.- Throws:
IOException- If I/O errors occur.
-
readExternalData
protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundExceptionLoad object's specific data content.- Specified by:
readExternalDatain classIgniteDataTransferObject- Parameters:
protoVer- Input object version.in- Input object to load data content.- Throws:
IOException- If I/O errors occur.ClassNotFoundException- If the class for an object being restored cannot be found.
-
-