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

## Class GridDhtLocalPartition

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

All Implemented Interfaces:
  Comparable<GridDhtLocalPartition>, GridReservable, GridCacheConcurrentMap

    public class GridDhtLocalPartition
    extends GridCacheConcurrentMapImpl
    implements Comparable<GridDhtLocalPartition>, GridReservable

Key partition.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap

`GridCacheConcurrentMap.CacheMapHolder`

### Field Summary

Fields
`static int` `MAX_DELETE_QUEUE_SIZE` Maximum size for delete queue.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `addReservation(GridDhtPartitionsReservation r)` Adds group reservation to this partition.
`boolean` `backup(AffinityTopologyVersion topVer)`
`void` `cleanupRemoveQueue()`
`void` `clearAll()` Clears values for this partition.
`int` `compareTo(GridDhtLocalPartition part)`
`IgniteCacheOffheapManager.CacheDataStore` `dataStore()`
`void` `decrementPublicSize(GridCacheConcurrentMap.CacheMapHolder hld, GridCacheEntryEx e)` Decrements public size.
`protected GridCacheConcurrentMap.CacheMapHolder` `entriesMap(GridCacheContext cctx)`
`protected GridCacheConcurrentMap.CacheMapHolder` `entriesMapIfExists(Integer cacheId)`
`boolean` `equals(Object obj)`
`int` `hashCode()`
`int` `id()`
`void` `incrementPublicSize(GridCacheConcurrentMap.CacheMapHolder hld, GridCacheEntryEx e)` Increments public size.
`Long` `initialUpdateCounter()`
`void` `initialUpdateCounter(long val)`
`int` `internalSize()` Returns the number of key-value mappings in this map.
`boolean` `isEmpty()`
`void` `lock()` Locks partition.
`void` `onDeferredDelete(int cacheId, KeyCacheObject key, GridCacheVersion ver)`
`boolean` `primary(AffinityTopologyVersion topVer)`
`int` `publicSize(int cacheId)` Returns the number of publicly available key-value mappings in this map.
`void` `release()` Releases previously reserved partition.
`protected void` `release(int sizeChange, GridCacheConcurrentMap.CacheMapHolder hld, GridCacheEntryEx e)`
`boolean` `reload()`
`void` `reload(boolean value)`
`void` `removeReservation(GridDhtPartitionsReservation r)`
`IgniteInternalFuture<?>` `rent(boolean updateSeq)`
`int` `reservations()`
`boolean` `reserve()` Reserves a partition so it won't be cleared.
`void` `restoreState(GridDhtPartitionState stateToRestore)`
`boolean` `shouldBeRenting()`
`GridDhtPartitionState` `state()`
`String` `toString()`
`void` `tryEvict()`
`void` `tryEvictAsync(boolean updateSeq)`
`void` `unlock()` Unlocks partition.
`long` `updateCounter()`
`void` `updateCounter(long val)`
`boolean` `valid()`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheConcurrentMapImpl

`entries, entrySet, getEntry, putEntryIfObsoleteOrAbsent, putEntryIfObsoleteOrAbsent, removeEntry`

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

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

### Field Detail

#### MAX_DELETE_QUEUE_SIZE

    public static final int MAX_DELETE_QUEUE_SIZE

Maximum size for delete queue.

### Method Detail

#### internalSize

    public int internalSize()

Returns the number of key-value mappings in this map. It does not include entries from underlying data store.

Specified by:
  `internalSize` in interface `GridCacheConcurrentMap`
Returns:
  the number of key-value mappings in this map.

#### entriesMap

    protected GridCacheConcurrentMap.CacheMapHolder entriesMap(GridCacheContext cctx)

Specified by:
  `entriesMap` in class `GridCacheConcurrentMapImpl`
Parameters:
  `cctx` - Cache context.
Returns:
  Map for given cache ID.

#### entriesMapIfExists

    @Nullable
    protected GridCacheConcurrentMap.CacheMapHolder entriesMapIfExists(Integer cacheId)

Specified by:
  `entriesMapIfExists` in class `GridCacheConcurrentMapImpl`
Parameters:
  `cacheId` - Cache ID.
Returns:
  Map for given cache ID.

#### dataStore

    public IgniteCacheOffheapManager.CacheDataStore dataStore()

Returns:
  Data store.

#### addReservation

    public boolean addReservation(GridDhtPartitionsReservation r)

Adds group reservation to this partition.

Parameters:
  `r` - Reservation.
Returns:
  `false` If such reservation already added.

#### removeReservation

    public void removeReservation(GridDhtPartitionsReservation r)

Parameters:
  `r` - Reservation.

#### id

    public int id()

Returns:
  Partition ID.

#### state

    public GridDhtPartitionState state()

Returns:
  Partition state.

#### shouldBeRenting

    public boolean shouldBeRenting()

Returns:
  `True` if partition is marked for transfer to renting state.

#### reservations

    public int reservations()

Returns:
  Reservations.

#### isEmpty

    public boolean isEmpty()

Returns:
  `True` if partition is empty.

#### valid

    public boolean valid()

Returns:
  If partition is moving or owning or renting.

#### cleanupRemoveQueue

    public void cleanupRemoveQueue()

#### onDeferredDelete

    public void onDeferredDelete(int cacheId,
                                 KeyCacheObject key,
                                 GridCacheVersion ver)

Parameters:
  `cacheId` - cacheId Cache ID.
  `key` - Removed key.
  `ver` - Removed version.

#### lock

    public void lock()

Locks partition.

#### unlock

    public void unlock()

Unlocks partition.

#### reserve

    public boolean reserve()

Reserves a partition so it won't be cleared.

Specified by:
  `reserve` in interface `GridReservable`
Overrides:
  `reserve` in class `GridCacheConcurrentMapImpl`
Returns:
  `True` if reserved.

#### release

    public void release()

Releases previously reserved partition.

Specified by:
  `release` in interface `GridReservable`
Overrides:
  `release` in class `GridCacheConcurrentMapImpl`

#### release

    protected void release(int sizeChange,
                           GridCacheConcurrentMap.CacheMapHolder hld,
                           GridCacheEntryEx e)

Overrides:
  `release` in class `GridCacheConcurrentMapImpl`
Parameters:
  `sizeChange` - Size delta.
  `hld` - Map holder.
  `e` - Map entry.

#### restoreState

    public void restoreState(GridDhtPartitionState stateToRestore)

Parameters:
  `stateToRestore` - State to restore.

#### reload

    public boolean reload()

Returns:
  `True` if partition should be re-created after it is cleared.

#### reload

    public void reload(boolean value)

Parameters:
  `value` - `reload` flag value.

#### rent

    public IgniteInternalFuture<?> rent(boolean updateSeq)

Parameters:
  `updateSeq` - Update sequence.
Returns:
  Future to signal that this node is no longer an owner or backup.

#### tryEvictAsync

    public void tryEvictAsync(boolean updateSeq)

Parameters:
  `updateSeq` - Update sequence.

#### tryEvict

    public void tryEvict()
                  throws NodeStoppingException

Throws:
  `NodeStoppingException` - If node is stopping.

#### primary

    public boolean primary(AffinityTopologyVersion topVer)

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

#### backup

    public boolean backup(AffinityTopologyVersion topVer)

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

#### updateCounter

    public long updateCounter()

Returns:
  Current update index.

#### initialUpdateCounter

    public Long initialUpdateCounter()

Returns:
  Initial update counter.

#### updateCounter

    public void updateCounter(long val)

Parameters:
  `val` - Update index value.

#### initialUpdateCounter

    public void initialUpdateCounter(long val)

Parameters:
  `val` - Initial update index value.

#### clearAll

    public void clearAll()
                  throws NodeStoppingException

Clears values for this partition.

Throws:
  `NodeStoppingException` - If node stopping.

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

#### publicSize

    public int publicSize(int cacheId)

Returns the number of publicly available key-value mappings in this map. It excludes entries that are marked as deleted. It also does not include entries from underlying data store.

Specified by:
  `publicSize` in interface `GridCacheConcurrentMap`
Parameters:
  `cacheId` - Cache ID.
Returns:
  the number of publicly available key-value mappings in this map.

#### incrementPublicSize

    public void incrementPublicSize(@Nullable
                                    GridCacheConcurrentMap.CacheMapHolder hld,
                                    GridCacheEntryEx e)

Increments public size.

Specified by:
  `incrementPublicSize` in interface `GridCacheConcurrentMap`
Parameters:
  `hld` - Cache map (passed as optimization to avoid cache map lookup for shared groups).
  `e` - Entry that caused public size change.

#### decrementPublicSize

    public void decrementPublicSize(@Nullable
                                    GridCacheConcurrentMap.CacheMapHolder hld,
                                    GridCacheEntryEx e)

Decrements public size.

Specified by:
  `decrementPublicSize` in interface `GridCacheConcurrentMap`
Parameters:
  `hld` - Cache map (passed as optimization to avoid cache map lookup for shared groups).
  `e` - Entry that caused public size change.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.4.0
Release Date | : March 5 2018