All Known Implementing Classes:
BlockManagerImpl

public interface BlockManager
BlockManager is for performing key related operations on the container.
  • Method Details

    • putBlock

      long putBlock(Container container, org.apache.hadoop.ozone.container.common.helpers.BlockData data) throws IOException
      Puts or overwrites a block.
      Parameters:
      container - - Container for which block need to be added.
      data - - Block Data.
      Returns:
      length of the Block.
      Throws:
      IOException
    • putBlock

      long putBlock(Container container, org.apache.hadoop.ozone.container.common.helpers.BlockData data, boolean endOfBlock) throws IOException
      Puts or overwrites a block.
      Parameters:
      container - - Container for which block need to be added.
      data - - Block Data.
      endOfBlock - - The last putBlock call for this block (when all the chunks are written and stream is closed)
      Returns:
      length of the Block.
      Throws:
      IOException
    • putBlockForClosedContainer

      long putBlockForClosedContainer(Container container, org.apache.hadoop.ozone.container.common.helpers.BlockData data, boolean overwriteBcsId) throws IOException
      Persists the block data for a closed container. The block data should have all the chunks and bcsId. Overwrites the block if it already exists, The container's used bytes should be updated by the caller with ChunkManager.writeChunk(Container, BlockID, ChunkInfo, ByteBuffer, DispatcherContext).
      Parameters:
      container - - Container for which block data need to be persisted.
      data - - Block Data to be persisted (BlockData should have the chunks).
      overwriteBcsId - - To overwrite bcsId of the container.
      Throws:
      IOException
    • getBlock

      org.apache.hadoop.ozone.container.common.helpers.BlockData getBlock(Container container, org.apache.hadoop.hdds.client.BlockID blockID) throws IOException
      Gets an existing block.
      Parameters:
      container - - Container from which block needs to be fetched.
      blockID - - BlockID of the Block.
      Returns:
      Block Data.
      Throws:
      IOException - when BcsId is unknown or mismatched
    • deleteBlock

      void deleteBlock(Container container, org.apache.hadoop.hdds.client.BlockID blockID) throws IOException
      Deletes an existing block.
      Parameters:
      container - - Container from which block need to be deleted.
      blockID - - ID of the block.
      Throws:
      IOException
    • listBlock

      List<org.apache.hadoop.ozone.container.common.helpers.BlockData> listBlock(Container container, long startLocalID, int count) throws IOException
      List blocks in a container.
      Parameters:
      container - - Container from which blocks need to be listed.
      startLocalID - - Block to start from, 0 to begin.
      count - - Number of blocks to return.
      Returns:
      List of Blocks that match the criteria.
      Throws:
      IOException
    • blockExists

      boolean blockExists(Container container, org.apache.hadoop.hdds.client.BlockID blockID) throws IOException
      Check if a block exists in the container.
      Parameters:
      container - - Container from which blocks need to be listed.
      blockID - - BlockID of the Block.
      Returns:
      True if block exists, false otherwise.
      Throws:
      IOException
    • getCommittedBlockLength

      long getCommittedBlockLength(Container container, org.apache.hadoop.hdds.client.BlockID blockID) throws IOException
      Returns last committed length of the block.
      Parameters:
      container - - Container from which block need to be fetched.
      blockID - - BlockID of the block.
      Returns:
      length of the block.
      Throws:
      IOException - in case, the block key does not exist in db.
    • finalizeBlock

      void finalizeBlock(Container container, org.apache.hadoop.hdds.client.BlockID blockId) throws IOException
      Throws:
      IOException
    • getDefaultReadBufferCapacity

      int getDefaultReadBufferCapacity()
    • getReadMappedBufferThreshold

      int getReadMappedBufferThreshold()
      Returns:
      the threshold to read using memory mapped buffers.
    • getReadMappedBufferMaxCount

      int getReadMappedBufferMaxCount()
      Returns:
      the max count of memory mapped buffers to read.
    • isReadNettyChunkedNioFile

      boolean isReadNettyChunkedNioFile()
      Returns:
      true iff Netty ChunkedNioFile read is enabled.
    • shutdown

      void shutdown()
      Shutdown ContainerManager.