org.apache.ignite.cache.affinity

## Interface AffinityFunctionContext

All Known Implementing Classes:
  GridAffinityFunctionContextImpl

    public interface AffinityFunctionContext

Affinity function context. This context is passed to `AffinityFunction` for partition reassignment on every topology change event.

### Method Summary

Methods
`int` `backups()` Gets number of backups for new assignment.
`List<ClusterNode>` `currentTopologySnapshot()` Gets current topology snapshot.
`AffinityTopologyVersion` `currentTopologyVersion()` Gets current topology version number.
`DiscoveryEvent` `discoveryEvent()` Gets discovery event caused topology change.
`List<ClusterNode>` `previousAssignment(int part)` Gets affinity assignment for given partition on previous topology version.

### Method Detail

#### previousAssignment

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

Parameters:
  `part` - Partition to get previous assignment for.
Returns:
  List of nodes assigned to given partition on previous topology version or `null` if this information is not available.

#### backups

    int backups()

Gets number of backups for new assignment.

Returns:
  Number of backups for new assignment.

#### currentTopologySnapshot

    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.

Returns:
  Cache topology snapshot.

#### currentTopologyVersion

    AffinityTopologyVersion currentTopologyVersion()

Gets current topology version number.

Returns:
  Current topology version number.

#### discoveryEvent

    @Nullable
    DiscoveryEvent discoveryEvent()

Gets discovery event caused topology change.

Returns:
  Discovery event caused latest topology change or `null` if this information is not available.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.4.0
Release Date | : September 24 2015