org.apache.ignite.internal.processors.affinity

## Class GridAffinityAssignment

- java.lang.Object
- - org.apache.ignite.internal.processors.affinity.GridAffinityAssignment

All Implemented Interfaces:
  Serializable, AffinityAssignment

    public class GridAffinityAssignment
    extends Object
    implements AffinityAssignment, Serializable

Cached affinity calculations.

See Also:
  Serialized Form

### Method Summary

Methods
`List<List<ClusterNode>>` `assignment()`
`Set<Integer>` `backupPartitions(UUID nodeId)` Get backup partitions for specified node ID.
`boolean` `clientEventChange()`
`boolean` `equals(Object o)`
`List<ClusterNode>` `get(int part)` Get affinity nodes for partition.
`HashSet<UUID>` `getIds(int part)` Get affinity node IDs for partition.
`int` `hashCode()`
`List<List<ClusterNode>>` `idealAssignment()`
`Set<ClusterNode>` `primaryPartitionNodes()`
`Set<Integer>` `primaryPartitions(UUID nodeId)` Get primary partitions for specified node ID.
`AffinityTopologyVersion` `topologyVersion()`
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Method Detail

#### clientEventChange

    public boolean clientEventChange()

Specified by:
  `clientEventChange` in interface `AffinityAssignment`
Returns:
  `True` if related discovery event did not not cause affinity assignment change and this assignment is just reference to the previous one.

#### idealAssignment

    public List<List<ClusterNode>> idealAssignment()

Specified by:
  `idealAssignment` in interface `AffinityAssignment`
Returns:
  Affinity assignment computed by affinity function.

#### assignment

    public List<List<ClusterNode>> assignment()

Specified by:
  `assignment` in interface `AffinityAssignment`
Returns:
  Affinity assignment.

#### topologyVersion

    public AffinityTopologyVersion topologyVersion()

Specified by:
  `topologyVersion` in interface `AffinityAssignment`
Returns:
  Topology version.

#### get

    public List<ClusterNode> get(int part)

Get affinity nodes for partition.

Specified by:
  `get` in interface `AffinityAssignment`
Parameters:
  `part` - Partition.
Returns:
  Affinity nodes.

#### getIds

    public HashSet<UUID> getIds(int part)

Get affinity node IDs for partition.

Specified by:
  `getIds` in interface `AffinityAssignment`
Parameters:
  `part` - Partition.
Returns:
  Affinity nodes IDs.

#### primaryPartitionNodes

    public Set<ClusterNode> primaryPartitionNodes()

Specified by:
  `primaryPartitionNodes` in interface `AffinityAssignment`
Returns:
  Nodes having primary partitions assignments.

#### primaryPartitions

    public Set<Integer> primaryPartitions(UUID nodeId)

Get primary partitions for specified node ID.

Specified by:
  `primaryPartitions` in interface `AffinityAssignment`
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:
  `backupPartitions` in interface `AffinityAssignment`
Parameters:
  `nodeId` - Node ID to get backup partitions for.
Returns:
  Backup partitions for specified node ID.

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.8.0
Release Date | : December 5 2016