Class BlockId


  • @ThreadSafe
    public final class BlockId
    extends java.lang.Object
    This class provides a set of methods related to block IDs. Each block ID is a value of long with the following two parts:
    • The most significant 5 bytes (40 bits) represent the container ID of this block and
    • The least significant 3 bytes (24 bits) represent the sequence number of this block in the container.
    • Method Detail

      • createBlockId

        public static long createBlockId​(long containerId,
                                         long sequenceNumber)
        Parameters:
        containerId - the container ID to create the block ID with
        sequenceNumber - the sequence number to create the block ID with
        Returns:
        the block ID constructed with the container ID and sequence number
      • getContainerId

        public static long getContainerId​(long blockId)
        Parameters:
        blockId - the block ID to get the container ID for
        Returns:
        the container ID of a specified block ID
      • getFileId

        public static long getFileId​(long blockId)
        Parameters:
        blockId - the block ID to get the file ID for
        Returns:
        the file ID of a specified block ID
      • getSequenceNumber

        public static long getSequenceNumber​(long blockId)
        Parameters:
        blockId - the block ID to get the sequence number for
        Returns:
        the sequence number of the specified block ID
      • getMaxSequenceNumber

        public static long getMaxSequenceNumber()
        Returns:
        the maximum possible sequence number for block IDs