Class BlockResolver

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.BlockResolver
Direct Known Subclasses:
FixedBlockResolver

@Public @Unstable public abstract class BlockResolver extends Object
Given an external reference, create a sequence of blocks and associated metadata.
  • Constructor Details

    • BlockResolver

      public BlockResolver()
  • Method Details

    • buildBlock

      protected org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto buildBlock(long blockId, long bytes)
    • buildBlock

      protected org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto buildBlock(long blockId, long bytes, long genstamp)
    • resolve

      public Iterable<org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto> resolve(FileStatus s)
      Parameters:
      s - the external reference.
      Returns:
      sequence of blocks that make up the reference.
    • nextId

      public abstract long nextId()
      Returns:
      the next block id.
    • lastId

      protected abstract long lastId()
      Returns:
      the maximum sequentially allocated block ID for this filesystem.
    • blockLengths

      protected abstract List<Long> blockLengths(FileStatus status)
      Parameters:
      status - the external reference.
      Returns:
      the lengths of the resultant blocks.
    • preferredBlockSize

      public long preferredBlockSize(FileStatus status)
      Parameters:
      status - the external reference.
      Returns:
      the block size to assign to this external reference.
    • getReplication

      public abstract int getReplication(FileStatus status)
      Parameters:
      status - the external reference.
      Returns:
      the replication to assign to this external reference.