Example usage for org.apache.hadoop.hdfs.protocol ExtendedBlock getBlockName

List of usage examples for org.apache.hadoop.hdfs.protocol ExtendedBlock getBlockName

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol ExtendedBlock getBlockName.

Prototype

public String getBlockName() 

Source Link

Document

Returns the block file name for the block

Usage

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

License:Apache License

/**
 * Get file correpsonding to a block/*from  ww w.  j a v  a 2s  .  co  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 w w  w.  java  2s. co  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);
}