Search in sources :

Example 1 with DirectoryInputStream

use of org.apache.crail.core.DirectoryInputStream 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();
}
Also used : FileName(org.apache.crail.metadata.FileName) DirectoryRecord(org.apache.crail.core.DirectoryRecord) CrailConfiguration(org.apache.crail.conf.CrailConfiguration) CoreDataStore(org.apache.crail.core.CoreDataStore) DirectoryInputStream(org.apache.crail.core.DirectoryInputStream)

Aggregations

CrailConfiguration (org.apache.crail.conf.CrailConfiguration)1 CoreDataStore (org.apache.crail.core.CoreDataStore)1 DirectoryInputStream (org.apache.crail.core.DirectoryInputStream)1 DirectoryRecord (org.apache.crail.core.DirectoryRecord)1 FileName (org.apache.crail.metadata.FileName)1