org.apache.ignite.internal.processors.cache.distributed.dht

## Interface GridDhtPartitionTopology

All Known Implementing Classes:
  GridClientPartitionTopology

    @GridToStringExclude
    public interface GridDhtPartitionTopology

DHT partition topology.

### Method Summary

Methods
`boolean` `afterExchange(GridDhtPartitionsExchangeFuture exchFut)` Post-initializes this topology.
`void` `beforeExchange(GridDhtPartitionsExchangeFuture exchFut, boolean affReady)` Pre-initializes this topology.
`Iterable<GridDhtLocalPartition>` `currentLocalPartitions()`
`void` `initPartitions(GridDhtPartitionsExchangeFuture exchFut)`
`GridDhtLocalPartition` `localPartition(int p, AffinityTopologyVersion topVer, boolean create)`
`GridDhtLocalPartition` `localPartition(Object key, boolean create)`
`GridDhtPartitionMap2` `localPartitionMap()`
`List<GridDhtLocalPartition>` `localPartitions()`
`List<ClusterNode>` `moving(int p)`
`List<ClusterNode>` `nodes(int p, AffinityTopologyVersion topVer)`
`void` `onEvicted(GridDhtLocalPartition part, boolean updateSeq)`
`void` `onRemoved(GridDhtCacheEntry e)`
`boolean` `own(GridDhtLocalPartition part)`
`List<ClusterNode>` `owners(int p)`
`List<ClusterNode>` `owners(int p, AffinityTopologyVersion topVer)`
`GridDhtPartitionFullMap` `partitionMap(boolean onlyActive)`
`GridDhtPartitionMap2` `partitions(UUID nodeId)`
`GridDhtPartitionState` `partitionState(UUID nodeId, int part)`
`void` `printMemoryStats(int threshold)` Prints memory stats.
`void` `readLock()` Locks the topology, usually during mapping on locks or transactions.
`void` `readUnlock()` Unlocks topology locked by `readLock()` method.
`boolean` `rebalanceFinished(AffinityTopologyVersion topVer)`
`void` `releasePartitions(int... parts)`
`boolean` `stopping()`
`AffinityTopologyVersion` `topologyVersion()` Topology version.
`GridDhtTopologyFuture` `topologyVersionFuture()` Gets a future that will be completed when partition exchange map for this particular topology version is done.
`GridDhtPartitionMap2` `update(GridDhtPartitionExchangeId exchId, GridDhtPartitionFullMap partMap, Map<Integer,Long> cntrMap)`
`GridDhtPartitionMap2` `update(GridDhtPartitionExchangeId exchId, GridDhtPartitionMap2 parts, Map<Integer,Long> cntrMap)`
`Map<Integer,Long>` `updateCounters(boolean skipZeros)`
`long` `updateSequence()`
`void` `updateTopologyVersion(GridDhtPartitionExchangeId exchId, GridDhtPartitionsExchangeFuture exchFut, long updateSeq, boolean stopping)` Updates topology version.

### Method Detail

#### readLock

    void readLock()

Locks the topology, usually during mapping on locks or transactions.

#### readUnlock

    void readUnlock()

Unlocks topology locked by `readLock()` method.

#### updateTopologyVersion

    void updateTopologyVersion(GridDhtPartitionExchangeId exchId,
                             GridDhtPartitionsExchangeFuture exchFut,
                             long updateSeq,
                             boolean stopping)
                               throws IgniteInterruptedCheckedException

Updates topology version.

Parameters:
  `exchId` - Exchange ID.
  `exchFut` - Exchange future.
  `updateSeq` - Update sequence.
  `stopping` - Stopping flag.
Throws:
  `IgniteInterruptedCheckedException` - If interrupted.

#### topologyVersion

    AffinityTopologyVersion topologyVersion()

Topology version.

Returns:
  Topology version.

#### topologyVersionFuture

    GridDhtTopologyFuture topologyVersionFuture()

Gets a future that will be completed when partition exchange map for this particular topology version is done.

Returns:
  Topology version ready future.

#### stopping

    boolean stopping()

Returns:
  `True` if cache is being stopped.

#### beforeExchange

    void beforeExchange(GridDhtPartitionsExchangeFuture exchFut,
                      boolean affReady)
                        throws IgniteCheckedException

Pre-initializes this topology.

Parameters:
  `exchFut` - Exchange future.
  `affReady` - Affinity ready flag.
Throws:
  `IgniteCheckedException` - If failed.

#### initPartitions

    void initPartitions(GridDhtPartitionsExchangeFuture exchFut)
                        throws IgniteInterruptedCheckedException

Parameters:
  `exchFut` - Exchange future.
Throws:
  `IgniteInterruptedCheckedException` - If interrupted.

#### afterExchange

    boolean afterExchange(GridDhtPartitionsExchangeFuture exchFut)
                          throws IgniteCheckedException

Post-initializes this topology.

Parameters:
  `exchFut` - Exchange future.
Returns:
  `True` if mapping was changed.
Throws:
  `IgniteCheckedException` - If failed.

#### localPartition

    @Nullable
    GridDhtLocalPartition localPartition(int p,
                                                AffinityTopologyVersion topVer,
                                                boolean create)
                                         throws GridDhtInvalidPartitionException

Parameters:
  `topVer` - Topology version at the time of creation.
  `p` - Partition ID.
  `create` - If `true`, then partition will be created if it's not there.
Returns:
  Local partition.
Throws:
  `GridDhtInvalidPartitionException` - If partition is evicted or absent and does not belong to this node.

#### releasePartitions

    void releasePartitions(int... parts)

Parameters:
  `parts` - Partitions to release (should be reserved before).

#### localPartition

    @Nullable
    GridDhtLocalPartition localPartition(Object key,
                                                boolean create)
                                         throws GridDhtInvalidPartitionException

Parameters:
  `key` - Cache key.
  `create` - If `true`, then partition will be created if it's not there.
Returns:
  Local partition.
Throws:
  `GridDhtInvalidPartitionException` - If partition is evicted or absent and does not belong to this node.

#### localPartitions

    List<GridDhtLocalPartition> localPartitions()

Returns:
  All local partitions by copying them into another list.

#### currentLocalPartitions

    Iterable<GridDhtLocalPartition> currentLocalPartitions()

Returns:
  All current local partitions.

#### localPartitionMap

    GridDhtPartitionMap2 localPartitionMap()

Returns:
  Local IDs.

#### partitionState

    GridDhtPartitionState partitionState(UUID nodeId,
                                       int part)

Parameters:
  `nodeId` - Node ID.
  `part` - Partition.
Returns:
  Partition state.

#### updateSequence

    long updateSequence()

Returns:
  Current update sequence.

#### nodes

    List<ClusterNode> nodes(int p,
                          AffinityTopologyVersion topVer)

Parameters:
  `p` - Partition ID.
  `topVer` - Topology version.
Returns:
  Collection of all nodes responsible for this partition with primary node being first.

#### owners

    List<ClusterNode> owners(int p)

Parameters:
  `p` - Partition ID.
Returns:
  Collection of all nodes who `own` this partition.

#### owners

    List<ClusterNode> owners(int p,
                           AffinityTopologyVersion topVer)

Parameters:
  `p` - Partition ID.
  `topVer` - Topology version.
Returns:
  Collection of all nodes who `own` this partition.

#### moving

    List<ClusterNode> moving(int p)

Parameters:
  `p` - Partition ID.
Returns:
  Collection of all nodes who `are preloading` this partition.

#### partitionMap

    GridDhtPartitionFullMap partitionMap(boolean onlyActive)

Parameters:
  `onlyActive` - If `true`, then only `active` partitions will be returned.
Returns:
  Node IDs mapped to partitions.

#### onRemoved

    void onRemoved(GridDhtCacheEntry e)

Parameters:
  `e` - Entry removed from cache.

#### update

    GridDhtPartitionMap2 update(@Nullable
                              GridDhtPartitionExchangeId exchId,
                              GridDhtPartitionFullMap partMap,
                              @Nullable
                              Map<Integer,Long> cntrMap)

Parameters:
  `exchId` - Exchange ID.
  `partMap` - Update partition map.
  `cntrMap` - Partition update counters.
Returns:
  Local partition map if there were evictions or `null` otherwise.

#### update

    @Nullable
    GridDhtPartitionMap2 update(@Nullable
                                       GridDhtPartitionExchangeId exchId,
                                       GridDhtPartitionMap2 parts,
                                       @Nullable
                                       Map<Integer,Long> cntrMap)

Parameters:
  `exchId` - Exchange ID.
  `parts` - Partitions.
  `cntrMap` - Partition update counters.
Returns:
  Local partition map if there were evictions or `null` otherwise.

#### updateCounters

    Map<Integer,Long> updateCounters(boolean skipZeros)

Parameters:
  `skipZeros` - If `true` then filters out zero counters.
Returns:
  Partition update counters.

#### own

    boolean own(GridDhtLocalPartition part)

Parameters:
  `part` - Partition to own.
Returns:
  `True` if owned.

#### onEvicted

    void onEvicted(GridDhtLocalPartition part,
                 boolean updateSeq)

Parameters:
  `part` - Evicted partition.
  `updateSeq` - Update sequence increment flag.

#### partitions

    @Nullable
    GridDhtPartitionMap2 partitions(UUID nodeId)

Parameters:
  `nodeId` - Node to get partitions for.
Returns:
  Partitions for node.

#### printMemoryStats

    void printMemoryStats(int threshold)

Prints memory stats.

Parameters:
  `threshold` - Threshold for number of entries.

#### rebalanceFinished

    boolean rebalanceFinished(AffinityTopologyVersion topVer)

Parameters:
  `topVer` - Topology version.
Returns:
  `True` if rebalance process finished.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

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