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

## Class GridDhtLocalPartition

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition

All Implemented Interfaces:
  Comparable<GridDhtLocalPartition>

    public class GridDhtLocalPartition
    extends Object
    implements Comparable<GridDhtLocalPartition>

Key partition.

### Method Summary

Methods
`int` `compareTo(GridDhtLocalPartition part)`
`void` `decrementPublicSize()` Decrements public size of the map.
`Collection<GridDhtCacheEntry>` `entries()`
`boolean` `equals(Object obj)`
`int` `hashCode()`
`int` `id()`
`void` `incrementPublicSize()` Increments public size of the map.
`boolean` `isEmpty()`
`void` `lock()` Locks partition.
`void` `onDeferredDelete(KeyCacheObject key, GridCacheVersion ver)`
`void` `onEntryEvicted(KeyCacheObject key, GridCacheVersion ver)`
`boolean` `preloadingPermitted(KeyCacheObject key, GridCacheVersion ver)` Cache preloader should call this method within partition lock.
`boolean` `primary(AffinityTopologyVersion topVer)`
`int` `publicSize()`
`void` `release()` Releases previously reserved partition.
`int` `reservations()`
`boolean` `reserve()` Reserves a partition so it won't be cleared.
`int` `size()`
`GridDhtPartitionState` `state()`
`String` `toString()`
`void` `unlock()` Unlocks partition.
`boolean` `valid()`

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

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

### Method Detail

#### id

    public int id()

Returns:
  Partition ID.

#### state

    public GridDhtPartitionState state()

Returns:
  Partition state.

#### reservations

    public int reservations()

Returns:
  Reservations.

#### entries

    public Collection<GridDhtCacheEntry> entries()

Returns:
  Entries belonging to partition.

#### isEmpty

    public boolean isEmpty()

Returns:
  `True` if partition is empty.

#### size

    public int size()

Returns:
  Number of entries in this partition (constant-time method).

#### incrementPublicSize

    public void incrementPublicSize()

Increments public size of the map.

#### decrementPublicSize

    public void decrementPublicSize()

Decrements public size of the map.

#### publicSize

    public int publicSize()

Returns:
  Number of public (non-internal) entries in this partition.

#### valid

    public boolean valid()

Returns:
  If partition is moving or owning or renting.

#### onDeferredDelete

    public void onDeferredDelete(KeyCacheObject key,
                        GridCacheVersion ver)
                          throws IgniteCheckedException

Parameters:
  `key` - Removed key.
  `ver` - Removed version.
Throws:
  `IgniteCheckedException` - If failed.

#### lock

    public void lock()

Locks partition.

#### unlock

    public void unlock()

Unlocks partition.

#### onEntryEvicted

    public void onEntryEvicted(KeyCacheObject key,
                      GridCacheVersion ver)

Parameters:
  `key` - Key.
  `ver` - Version.

#### preloadingPermitted

    public boolean preloadingPermitted(KeyCacheObject key,
                              GridCacheVersion ver)

Cache preloader should call this method within partition lock.

Parameters:
  `key` - Key.
  `ver` - Version.
Returns:
  `True` if preloading is permitted.

#### reserve

    public boolean reserve()

Reserves a partition so it won't be cleared.

Returns:
  `True` if reserved.

#### release

    public void release()

Releases previously reserved partition.

#### primary

    public boolean primary(AffinityTopologyVersion topVer)

Parameters:
  `topVer` - Topology version.
Returns:
  `True` if local node is primary for this partition.

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### compareTo

    public int compareTo(@NotNull
                GridDhtLocalPartition part)

Specified by:
  `compareTo` in interface `Comparable<GridDhtLocalPartition>`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0
Release Date | : March 31 2015