org.apache.ignite.internal.pagemem

## Class PageIdUtils

- java.lang.Object
- - org.apache.ignite.internal.pagemem.PageIdUtils

    public final class PageIdUtils
    extends Object

Utility class for page ID parts manipulation.

See Also:
  `FullPageId`

### Field Summary

Fields
`static long` `FLAG_MASK` Flags mask.
`static int` `FLAG_SIZE`
`static int` `MAX_ITEMID_NUM` Max itemid number.
`static long` `MAX_PAGE_NUM` Maximum page number.
`static int` `MAX_PART_ID` Maximum page number.
`static long` `OFFSET_MASK`
`static int` `OFFSET_SIZE`
`static long` `PAGE_IDX_MASK`
`static int` `PAGE_IDX_SIZE`
`static long` `PART_ID_MASK` Page Index is a monotonically growing number within each partition
`static int` `PART_ID_SIZE`
`static long` `TAG_MASK`
`static int` `TAG_SIZE`

### Method Summary

All Methods Static Methods Concrete Methods
`static long` `changePartitionId(long pageId, int partId)`
`static long` `changeType(long pageId, byte type)` Change page type.
`static long` `effectivePageId(long link)`
`static byte` `flag(long pageId)`
`static boolean` `isEffectivePageId(long pageId)`
`static int` `itemId(long link)` Index of the item inside of data page.
`static long` `link(long pageId, int itemId)` Constructs a page link by the given page ID and 8-byte words within the page.
`static long` `maskPartitionId(long pageId)` Masks partition ID from full page ID.
`static long` `pageId(int partId, byte flag, int pageIdx)`
`static long` `pageId(long link)` Extracts a page ID from the given page link.
`static int` `pageIndex(long pageId)` Extracts a page index from the given page ID.
`static int` `partId(long pageId)`
`static long` `rotatePageId(long pageId)`
`static int` `tag(long link)` Tag of pageId
`static String` `toDetailString(long pageId)`

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

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

### Field Detail

#### PAGE_IDX_SIZE

    public static final int PAGE_IDX_SIZE

See Also:
  Constant Field Values

#### PART_ID_SIZE

    public static final int PART_ID_SIZE

See Also:
  Constant Field Values

#### FLAG_SIZE

    public static final int FLAG_SIZE

See Also:
  Constant Field Values

#### OFFSET_SIZE

    public static final int OFFSET_SIZE

See Also:
  Constant Field Values

#### TAG_SIZE

    public static final int TAG_SIZE

See Also:
  Constant Field Values

#### PAGE_IDX_MASK

    public static final long PAGE_IDX_MASK

See Also:
  Constant Field Values

#### OFFSET_MASK

    public static final long OFFSET_MASK

See Also:
  Constant Field Values

#### TAG_MASK

    public static final long TAG_MASK

See Also:
  Constant Field Values

#### PART_ID_MASK

    public static final long PART_ID_MASK

Page Index is a monotonically growing number within each partition

See Also:
  Constant Field Values

#### FLAG_MASK

    public static final long FLAG_MASK

Flags mask. Flags consists from a number of reserved bits, and page type (data/index page)

See Also:
  Constant Field Values

#### MAX_ITEMID_NUM

    public static final int MAX_ITEMID_NUM

Max itemid number.

See Also:
  Constant Field Values

#### MAX_PAGE_NUM

    public static final long MAX_PAGE_NUM

Maximum page number.

See Also:
  Constant Field Values

#### MAX_PART_ID

    public static final int MAX_PART_ID

Maximum page number.

See Also:
  Constant Field Values

### Method Detail

#### link

    public static long link(long pageId,
                            int itemId)

Constructs a page link by the given page ID and 8-byte words within the page.

Parameters:
  `pageId` - Page ID.
  `itemId` - Item ID.
Returns:
  Page link.

#### pageIndex

    public static int pageIndex(long pageId)

Extracts a page index from the given page ID.

Parameters:
  `pageId` - Page ID.
Returns:
  Page index.

#### pageId

    public static long pageId(long link)

Extracts a page ID from the given page link.

Parameters:
  `link` - Page link.
Returns:
  Page ID.

#### effectivePageId

    public static long effectivePageId(long link)

Parameters:
  `link` - Page link.
Returns:
  Effective page id.

#### isEffectivePageId

    public static boolean isEffectivePageId(long pageId)

Parameters:
  `pageId` - Page id.
Returns:
  `True` if page id is equal to effective page id.

#### itemId

    public static int itemId(long link)

Index of the item inside of data page.

Parameters:
  `link` - Page link.
Returns:
  Offset in 8-byte words.

#### tag

    public static int tag(long link)

Tag of pageId

Parameters:
  `link` - Page link.
Returns:
  tag - item id + flags

#### pageId

    public static long pageId(int partId,
                              byte flag,
                              int pageIdx)

Parameters:
  `partId` - Partition ID.
  `flag` - Flags (a number of reserved bits, and page type (data/index page))
  `pageIdx` - Page index, monotonically growing number within each partition
Returns:
  Page ID constructed from the given pageIdx and partition ID, see `FullPageId`

#### flag

    public static byte flag(long pageId)

Parameters:
  `pageId` - Page ID.
Returns:
  Flag.

#### partId

    public static int partId(long pageId)

Parameters:
  `pageId` - Page ID.
Returns:
  Partition.

#### rotatePageId

    public static long rotatePageId(long pageId)

Parameters:
  `pageId` - Page ID.
Returns:
  New page ID.

#### maskPartitionId

    public static long maskPartitionId(long pageId)

Masks partition ID from full page ID.

Parameters:
  `pageId` - Page ID to mask partition ID from.

#### changeType

    public static long changeType(long pageId,
                                  byte type)

Change page type.

Parameters:
  `pageId` - Old page ID.
  `type` - New page type.
Returns:
  Changed page ID.

#### toDetailString

    public static String toDetailString(long pageId)

Parameters:
  `pageId` - Page id.

#### changePartitionId

    public static long changePartitionId(long pageId,
                                         int partId)

Parameters:
  `pageId` - Page ID.
  `partId` - Partition ID.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.5
Release Date | : June 4 2019