Enum Class BlockType

java.lang.Object
java.lang.Enum<BlockType>
org.apache.hadoop.hdfs.protocol.BlockType
All Implemented Interfaces:
Serializable, Comparable<BlockType>, Constable

public enum BlockType extends Enum<BlockType>
Type of a block. Previously, all blocks were replicated (contiguous). Then Erasure Coded blocks (striped) were implemented. BlockTypes are currently defined by the highest bit in the block id. If this bit is set, then the block is striped. Further extensions may claim the second bit s.t. the highest two bits are set. e.g. 0b00 == contiguous 0b10 == striped 0b11 == possible further extension block type.
  • Enum Constant Details

    • CONTIGUOUS

      public static final BlockType CONTIGUOUS
    • STRIPED

      public static final BlockType STRIPED
  • Method Details

    • values

      public static BlockType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BlockType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromBlockId

      public static BlockType fromBlockId(long blockId)
      Parse a BlockId to find the BlockType Note: the old block id generation algorithm was based on a pseudo random number generator, so there may be legacy blocks that make this conversion unreliable.