Example usage for org.apache.hadoop.hdfs.server.datanode DatanodeUtil idToBlockDir

List of usage examples for org.apache.hadoop.hdfs.server.datanode DatanodeUtil idToBlockDir

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.datanode DatanodeUtil idToBlockDir.

Prototype

public static File idToBlockDir(File root, long blockId) 

Source Link

Document

Get the directory where a finalized block with this ID should be stored.

Usage

From source file:com.mellanox.r4h.MiniDFSCluster.java

License:Apache License

/**
 * Get file correpsonding to a block//from  ww w  .  j  av  a  2s.  c o  m
 * 
 * @param storageDir
 *            storage directory
 * @param blk
 *            the block
 * @return data file corresponding to the block
 */
public static File getBlockFile(File storageDir, ExtendedBlock blk) {
    return new File(
            DatanodeUtil.idToBlockDir(getFinalizedDir(storageDir, blk.getBlockPoolId()), blk.getBlockId()),
            blk.getBlockName());
}

From source file:com.mellanox.r4h.MiniDFSCluster.java

License:Apache License

/**
 * Get the latest metadata file correpsonding to a block
 * //from   ww w  .j a  v a  2  s. c o m
 * @param storageDir
 *            storage directory
 * @param blk
 *            the block
 * @return metadata file corresponding to the block
 */
public static File getBlockMetadataFile(File storageDir, ExtendedBlock blk) {
    return new File(
            DatanodeUtil.idToBlockDir(getFinalizedDir(storageDir, blk.getBlockPoolId()), blk.getBlockId()),
            blk.getBlockName() + "_" + blk.getGenerationStamp() + Block.METADATA_EXTENSION);
}