org.apache.ignite.internal.processors.affinity

## Interface AffinityAssignment

All Known Subinterfaces:
  HistoryAffinityAssignment

All Known Implementing Classes:
  GridAffinityAssignment, GridAffinityAssignmentV2, HistoryAffinityAssignmentImpl, HistoryAffinityAssignmentShallowCopy

    public interface AffinityAssignment

Cached affinity calculations.

### Field Summary

Fields
`static int` `DFLT_AFFINITY_BACKUPS_THRESHOLD`
`static int` `IGNITE_AFFINITY_BACKUPS_THRESHOLD` Size threshold to use Map instead of List view.
`static boolean` `IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION` Disable memory affinity optimizations.

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods
`List<List<ClusterNode>>` `assignment()`
`default Collection<UUID>` `assignments2ids(List<ClusterNode> assignmentPart)` Converts List of Cluster Nodes to HashSet of UUIDs wrapped as unmodifiable collection.
`Set<Integer>` `backupPartitions(UUID nodeId)` Get backup partitions for specified node ID.
`List<ClusterNode>` `get(int part)` Get affinity nodes for partition.
`Collection<UUID>` `getIds(int part)` Get affinity node IDs for partition.
`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.
`AffinityTopologyVersion` `topologyVersion()`

### Field Detail

#### DFLT_AFFINITY_BACKUPS_THRESHOLD

    static final int DFLT_AFFINITY_BACKUPS_THRESHOLD

See Also:
  `IgniteSystemProperties.IGNITE_AFFINITY_BACKUPS_THRESHOLD`, Constant Field Values

#### IGNITE_AFFINITY_BACKUPS_THRESHOLD

    static final int IGNITE_AFFINITY_BACKUPS_THRESHOLD

Size threshold to use Map instead of List view.

#### IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION

    static final boolean IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION

Disable memory affinity optimizations.

### Method Detail

#### idealAssignment

    List<List<ClusterNode>> idealAssignment()

Returns:
  Affinity assignment computed by affinity function.

#### assignment

    List<List<ClusterNode>> assignment()

Returns:
  Affinity assignment.

#### topologyVersion

    AffinityTopologyVersion topologyVersion()

Returns:
  Topology version.

#### get

    List<ClusterNode> get(int part)

Get affinity nodes for partition.

Parameters:
  `part` - Partition.
Returns:
  Affinity nodes.

#### getIds

    Collection<UUID> getIds(int part)

Get affinity node IDs for partition.

Parameters:
  `part` - Partition.
Returns:
  Affinity nodes IDs.

#### nodes

    Set<ClusterNode> nodes()

Returns:
  Nodes having primary and backup assignments.

#### primaryPartitionNodes

    Set<ClusterNode> primaryPartitionNodes()

Returns:
  Nodes having primary partitions assignments.

#### primaryPartitions

    Set<Integer> primaryPartitions(UUID nodeId)

Get primary partitions for specified node ID.

Parameters:
  `nodeId` - Node ID to get primary partitions for.
Returns:
  Primary partitions for specified node ID.

#### backupPartitions

    Set<Integer> backupPartitions(UUID nodeId)

Get backup partitions for specified node ID.

Parameters:
  `nodeId` - Node ID to get backup partitions for.
Returns:
  Backup partitions for specified node ID.

#### partitionPrimariesDifferentToIdeal

    Set<Integer> partitionPrimariesDifferentToIdeal()

Returns:
  Set of partitions which primary is different to primary in ideal assignment.

#### assignments2ids

    default Collection<UUID> assignments2ids(List<ClusterNode> assignmentPart)

Converts List of Cluster Nodes to HashSet of UUIDs wrapped as unmodifiable collection.

Parameters:
  `assignmentPart` - Source assignment per partition.
Returns:
  List of deduplicated collections if ClusterNode's ids.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023