org.apache.ignite.internal.processors.affinity

## Class HistoryAffinityAssignmentShallowCopy

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

All Implemented Interfaces:
  AffinityAssignment, HistoryAffinityAssignment

    public class HistoryAffinityAssignmentShallowCopy
    extends Object
    implements HistoryAffinityAssignment

Shallow copy that contains reference to delegate `HistoryAffinityAssignment`.

### Field Summary

### 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 and Description
`HistoryAffinityAssignmentShallowCopy(HistoryAffinityAssignment histAssignment, AffinityTopologyVersion topVer)`

### Method Summary

All Methods Instance Methods Concrete Methods
`List<List<ClusterNode>>` `assignment()`
`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()`
`HistoryAffinityAssignment` `origin()` In case this instance is lightweight wrapper of another instance, this method should return reference to an original one.
`Set<Integer>` `partitionPrimariesDifferentToIdeal()`
`Set<ClusterNode>` `primaryPartitionNodes()`
`Set<Integer>` `primaryPartitions(UUID nodeId)` Get primary partitions for specified node ID.
`boolean` `requiresHistoryCleanup()` Should return true if instance is "heavy" and should be taken into account during history size management.
`AffinityTopologyVersion` `topologyVersion()`
`String` `toString()`

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

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

### Methods inherited from interface org.apache.ignite.internal.processors.affinity.AffinityAssignment

`assignments2ids`

### Constructor Detail

#### HistoryAffinityAssignmentShallowCopy

    public HistoryAffinityAssignmentShallowCopy(HistoryAffinityAssignment histAssignment,
                                                AffinityTopologyVersion topVer)

Parameters:
  `histAssignment` - History assignment.
  `topVer` - Topology version.

### Method Detail

#### requiresHistoryCleanup

    public boolean requiresHistoryCleanup()

Should return true if instance is "heavy" and should be taken into account during history size management.

Specified by:
  `requiresHistoryCleanup` in interface `HistoryAffinityAssignment`
Returns:
  `true` if adding this instance to history should trigger size check and possible cleanup.

#### 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 Collection<UUID> getIds(int part)

Get affinity node IDs for partition.

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

#### nodes

    public Set<ClusterNode> nodes()

Specified by:
  `nodes` in interface `AffinityAssignment`
Returns:
  Nodes having primary and backup assignments.

#### 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.

#### partitionPrimariesDifferentToIdeal

    public Set<Integer> partitionPrimariesDifferentToIdeal()

Specified by:
  `partitionPrimariesDifferentToIdeal` in interface `AffinityAssignment`
Returns:
  Set of partitions which primary is different to primary in ideal assignment.

#### origin

    public HistoryAffinityAssignment origin()

In case this instance is lightweight wrapper of another instance, this method should return reference to an original one. Otherwise, it should return `this` reference.

Specified by:
  `origin` in interface `HistoryAffinityAssignment`
Returns:
  Original instance of `this` if not applicable.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.14.0
Release Date | : September 29 2022