org.apache.ignite.cache.affinity

## Interface AffinityFunctionContext

-     public interface AffinityFunctionContext

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

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `backups()` Gets number of backups for new assignment.
    `List<ClusterNode>` | `currentTopologySnapshot()` Gets current topology snapshot.
    `org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion` | `currentTopologyVersion()` Gets current topology version number.
    `@Nullable DiscoveryEvent` | `discoveryEvent()` Gets discovery event caused topology change.
    `@Nullable List<ClusterNode>` | `previousAssignment(int part)` Gets affinity assignment for given partition on previous topology version.

- - ### Method Detail

    - #### previousAssignment

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

          org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion currentTopologyVersion()

      Gets current topology version number.
      Returns:
        Current topology version number.

    - #### discoveryEvent

          @Nullable
          @Nullable DiscoveryEvent discoveryEvent()

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

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023