org.apache.ignite.internal.processors.cache.persistence.pagemem

## Class FullPageIdTable

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.pagemem.FullPageIdTable

    public class FullPageIdTable
    extends Object

### Field Summary

Fields
`protected int` `capacity` Max size, in elements.
`protected int` `maxSteps` Maximum number of steps to try before failing.
`protected long` `valPtr` Pointer to the values array.

### Constructor Summary

Constructors
Constructor and Description
`FullPageIdTable(long addr, long len, boolean clear)`

### Method Summary

Methods
`int` `capacity()`
`void` `clear()`
`long` `clearAt(int idx, GridPredicate3<Integer,Long,Integer> pred, long absent)`
`int` `distanceFromIdeal(int cacheId, long pageId, int tag)` Gets distance from the ideal key location to the actual location if this entry is present in the table, or returns negative distance that needed to be scanned to determine the absence of the mapping.
`long` `get(int cacheId, long pageId, int tag, long absent, long outdated)` Gets value associated with the given key.
`EvictCandidate` `getNearestAt(int idx, long absent)` Find nearest value from specified position to the right.
`void` `put(int cacheId, long pageId, long value, int tag)` Associates the given key with the given value.
`long` `refresh(int cacheId, long pageId, int tag)` Refresh outdated value.
`void` `remove(int grpId, long pageId, int tag)` Removes key-value association for the given key.
`static long` `requiredMemory(long elementCnt)`
`int` `size()`
`void` `visitAll(IgniteBiInClosure<FullPageId,Long> visitor)` Scans all the elements in this table.

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### capacity

    protected int capacity

Max size, in elements.

#### maxSteps

    protected int maxSteps

Maximum number of steps to try before failing.

#### valPtr

    protected long valPtr

Pointer to the values array.

### Constructor Detail

#### FullPageIdTable

    public FullPageIdTable(long addr,
                   long len,
                   boolean clear)

Parameters:
  `addr` - Base address.
  `len` - Allocated memory length.
  `clear` - If `true`, then memory is considered dirty and will be cleared. Otherwise, map will assume that the given memory region is in valid state.

### Method Detail

#### requiredMemory

    public static long requiredMemory(long elementCnt)

Returns:
  Estimated memory size required for this map to store the given number of elements.

#### size

    public final int size()

Returns:
  Current number of entries in the map.

#### capacity

    public final int capacity()

Returns:
  Maximum number of entries in the map. This maximum can not be always reached.

#### get

    public long get(int cacheId,
           long pageId,
           int tag,
           long absent,
           long outdated)

Gets value associated with the given key.

Parameters:
  `cacheId` - Cache ID.
  `pageId` - Page ID.
Returns:
  A value associated with the given key.

#### refresh

    public long refresh(int cacheId,
               long pageId,
               int tag)

Refresh outdated value.

Parameters:
  `cacheId` - Cache ID.
  `pageId` - Page ID.
  `tag` - Partition tag.
Returns:
  A value associated with the given key.

#### put

    public void put(int cacheId,
           long pageId,
           long value,
           int tag)

Associates the given key with the given value.

Parameters:
  `cacheId` - Cache ID
  `pageId` - Page ID.
  `value` - Value to set.

#### remove

    public void remove(int grpId,
              long pageId,
              int tag)

Removes key-value association for the given key.

Parameters:
  `grpId` - Cache group ID.
  `pageId` - Page ID.

#### getNearestAt

    public EvictCandidate getNearestAt(int idx,
                              long absent)

Find nearest value from specified position to the right.

Parameters:
  `idx` - Index to start searching from.
  `absent` - Default value that will be returned if no values present.
Returns:
  Closest value to the index and it's partition tag or `absent` and -1 if no values found.

#### clearAt

    public long clearAt(int idx,
               GridPredicate3<Integer,Long,Integer> pred,
               long absent)

Parameters:
  `idx` - Index to clear value at.
  `pred` - Test predicate.
  `absent` - Value to return if the cell is empty.
Returns:
  Value at the given index.

#### distanceFromIdeal

    public int distanceFromIdeal(int cacheId,
                        long pageId,
                        int tag)

Gets distance from the ideal key location to the actual location if this entry is present in the table, or returns negative distance that needed to be scanned to determine the absence of the mapping.

Parameters:
  `cacheId` - Cache ID.
  `pageId` - Page ID.
  `tag` - Tag.
Returns:
  Distance scanned if the entry is found or negative distance scanned, if entry was not found.

#### visitAll

    public void visitAll(IgniteBiInClosure<FullPageId,Long> visitor)

Scans all the elements in this table.

Parameters:
  `visitor` - Visitor.

#### clear

    public void clear()

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017