List of usage examples for org.apache.hadoop.hdfs.protocol Block METADATA_EXTENSION
String METADATA_EXTENSION
To view the source code for org.apache.hadoop.hdfs.protocol Block METADATA_EXTENSION.
Click Source Link
From source file:com.mellanox.r4h.MiniDFSCluster.java
License:Apache License
/** * Get the latest metadata file correpsonding to a block * // ww w. j a v a2 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); }
From source file:com.mellanox.r4h.MiniDFSCluster.java
License:Apache License
/** * Return all block metadata files in given directory (recursive search) *//*from w w w .j a v a 2 s .c o m*/ public static List<File> getAllBlockMetadataFiles(File storageDir) { List<File> results = new ArrayList<File>(); File[] files = storageDir.listFiles(); if (files == null) { return null; } for (File f : files) { if (f.getName().startsWith("blk_") && f.getName().endsWith(Block.METADATA_EXTENSION)) { results.add(f); } else if (f.isDirectory()) { List<File> subdirResults = getAllBlockMetadataFiles(f); if (subdirResults != null) { results.addAll(subdirResults); } } } return results; }