Class OpenContainerBlockMap
java.lang.Object
org.apache.hadoop.ozone.container.common.impl.OpenContainerBlockMap
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChunk(org.apache.hadoop.hdds.client.BlockID blockID, org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ChunkInfo info) booleancheckIfBlockExists(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.voidremoveChunk(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.voidremoveContainer(long containerId) Removes the Container matching with specified containerId.voidremoveFromBlockMap(org.apache.hadoop.hdds.client.BlockID blockID) removes the block from the block map.
-
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 blockchunkInfo- 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
-