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 Modifier and Type Field Description static longFLAG_MASKFlags mask.static intFLAG_SIZEstatic intMAX_ITEMID_NUMMax itemid number.static longMAX_PAGE_NUMMaximum page number.static intMAX_PART_IDMaximum page number.static longOFFSET_MASKstatic intOFFSET_SIZEstatic longPAGE_IDX_MASKstatic intPAGE_IDX_SIZEstatic longPART_ID_MASKPage Index is a monotonically growing number within each partitionstatic intPART_ID_SIZEstatic longTAG_MASKstatic intTAG_SIZE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longchangePartitionId(long pageId, int partId)static longchangeType(long pageId, byte type)Change page type.static longeffectivePageId(long link)static byteflag(long pageId)static booleanisEffectivePageId(long pageId)static intitemId(long link)Index of the item inside of data page.static longlink(long pageId, int itemId)Constructs a page link by the given page ID and 8-byte words within the page.static longmaskPartitionId(long pageId)Masks partition ID from full page ID.static longpageId(int partId, byte flag, int pageIdx)static longpageId(long link)Extracts a page ID from the given page link.static intpageIndex(long pageId)Extracts a page index from the given page ID.static intpartId(long pageId)static longrotatePageId(long pageId)static longrotationId(long pageId)Returns the Rotation ID of a page identified by the given ID.static inttag(long link)Tag of pageIdstatic StringtoDetailString(long pageId)
-
-
-
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:
Trueif 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.
-
rotationId
public static long rotationId(long pageId)
Returns the Rotation ID of a page identified by the given ID.
-
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.
-
-