use of org.apache.crail.core.DirectoryRecord in project incubator-crail by apache.
the class CrailFsck method directoryDump.
public void directoryDump(String filename, boolean randomize) throws Exception {
CrailConfiguration conf = new CrailConfiguration();
CrailConstants.updateConstants(conf);
CoreDataStore fs = new CoreDataStore(conf);
DirectoryInputStream iter = fs._listEntries(filename, randomize);
System.out.println("#hash \t\tname\t\tfilecomponent");
int i = 0;
while (iter.hasRecord()) {
DirectoryRecord record = iter.nextRecord();
String path = CrailUtils.combinePath(record.getParent(), record.getFile());
FileName hash = new FileName(path);
System.out.format(i + ": " + "%08d\t\t%s\t%d\n", record.isValid() ? 1 : 0, padRight(record.getFile(), 8), hash.getFileComponent());
i++;
}
iter.close();
fs.closeFileSystem();
}
Aggregations