Class PageIdUtils


  • public final class PageIdUtils
    extends Object
    Utility class for page ID parts manipulation.
    See Also:
    FullPageId
    • 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.
      • 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.