org.apache.hadoop.hdfs.server.namenode

## Class BlockResolver

- java.lang.Object
- - org.apache.hadoop.hdfs.server.namenode.BlockResolver

- Direct Known Subclasses:
    FixedBlockResolver

      @InterfaceAudience.Public
       @InterfaceStability.Unstable
      public abstract class BlockResolver
      extends Object

  Given an external reference, create a sequence of blocks and associated metadata.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlockResolver()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract List<Long>` | `blockLengths(FileStatus status)`
    `protected org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto` | `buildBlock(long blockId, long bytes)`
    `protected org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto` | `buildBlock(long blockId, long bytes, long genstamp)`
    `abstract int` | `getReplication(FileStatus status)`
    `protected abstract long` | `lastId()`
    `abstract long` | `nextId()`
    `long` | `preferredBlockSize(FileStatus status)`
    `Iterable<org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto>` | `resolve(FileStatus s)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BlockResolver

          public BlockResolver()

  - ### Method Detail

    - #### 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.

Copyright © 2022 Apache Software Foundation. All rights reserved.