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

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

Introduction

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

Prototype

public long getGenerationStamp() 

Source Link

Usage

From source file:backup.store.BackupUtil.java

License:Apache License

public static org.apache.hadoop.hdfs.protocol.ExtendedBlock toHadoop(ExtendedBlock block) {
    if (block == null) {
        return null;
    }/*from   w  ww .ja  v  a  2  s. c o m*/
    return new org.apache.hadoop.hdfs.protocol.ExtendedBlock(block.getPoolId(), block.getBlockId(),
            block.getLength(), block.getGenerationStamp());
}

From source file:backup.store.BackupUtil.java

License:Apache License

public static ExtendedBlock fromHadoop(org.apache.hadoop.hdfs.protocol.ExtendedBlock block) {
    if (block == null) {
        return null;
    }//ww w  .j a v  a 2s .  c o  m
    return new ExtendedBlock(block.getBlockPoolId(), block.getBlockId(), block.getNumBytes(),
            block.getGenerationStamp());
}

From source file:com.bigstep.datalake.JsonUtil.java

License:Apache License

/** Convert an ExtendedBlock to a Json map. */
private static Map<String, Object> toJsonMap(final ExtendedBlock extendedblock) {
    if (extendedblock == null) {
        return null;
    }//from  ww w . ja  va  2 s. c  o m

    final Map<String, Object> m = new TreeMap<String, Object>();
    m.put("blockPoolId", extendedblock.getBlockPoolId());
    m.put("blockId", extendedblock.getBlockId());
    m.put("numBytes", extendedblock.getNumBytes());
    m.put("generationStamp", extendedblock.getGenerationStamp());
    return m;
}

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

License:Apache License

/**
 * Get the latest metadata file correpsonding to a block
 * // w  w w .j av a  2s . com
 * @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);
}