Class OpenContainerBlockMap

java.lang.Object
org.apache.hadoop.ozone.container.common.impl.OpenContainerBlockMap

public class OpenContainerBlockMap extends Object
Map: containerId -> (localId -> BlockData). The outer container map does not entail locking for a better performance. The inner BlockDataMap is synchronized. This class will maintain list of open keys per container when closeContainer command comes, it should autocommit all open keys of a open container before marking the container as closed.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addChunk(org.apache.hadoop.hdds.client.BlockID blockID, org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ChunkInfo info)
     
    boolean
    checkIfBlockExists(org.apache.hadoop.hdds.client.BlockID blockID)
    Returns true if the block exists in the map, false otherwise.
    List<org.apache.hadoop.ozone.container.common.helpers.BlockData>
    getOpenBlocks(long containerId)
    Returns the list of open blocks to the openContainerBlockMap.
    void
    removeChunk(org.apache.hadoop.hdds.client.BlockID blockID, org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ChunkInfo chunkInfo)
    Removes the chunk from the chunkInfo list for the given block.
    void
    removeContainer(long containerId)
    Removes the Container matching with specified containerId.
    void
    removeFromBlockMap(org.apache.hadoop.hdds.client.BlockID blockID)
    removes the block from the block map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OpenContainerBlockMap

      public OpenContainerBlockMap()
  • Method Details

    • removeContainer

      public void removeContainer(long containerId)
      Removes the Container matching with specified containerId.
      Parameters:
      containerId - containerId
    • addChunk

      public void addChunk(org.apache.hadoop.hdds.client.BlockID blockID, org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ChunkInfo info)
    • removeChunk

      public void removeChunk(org.apache.hadoop.hdds.client.BlockID blockID, org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ChunkInfo chunkInfo)
      Removes the chunk from the chunkInfo list for the given block.
      Parameters:
      blockID - id of the block
      chunkInfo - chunk info.
    • getOpenBlocks

      public List<org.apache.hadoop.ozone.container.common.helpers.BlockData> getOpenBlocks(long containerId)
      Returns the list of open blocks to the openContainerBlockMap.
      Parameters:
      containerId - container id
      Returns:
      List of open blocks
    • removeFromBlockMap

      public void removeFromBlockMap(org.apache.hadoop.hdds.client.BlockID blockID)
      removes the block from the block map.
      Parameters:
      blockID - - block ID
    • checkIfBlockExists

      public boolean checkIfBlockExists(org.apache.hadoop.hdds.client.BlockID blockID)
      Returns true if the block exists in the map, false otherwise.
      Parameters:
      blockID - - Block ID.
      Returns:
      True, if it exists, false otherwise