Search in sources :

Example 1 with CoreDataStore

use of org.apache.crail.core.CoreDataStore in project incubator-crail by apache.

the class CrailFsck method ping.

public void ping() throws Exception {
    CrailConfiguration conf = new CrailConfiguration();
    CrailConstants.updateConstants(conf);
    CoreDataStore fs = new CoreDataStore(conf);
    fs.ping();
    fs.closeFileSystem();
}
Also used : CrailConfiguration(org.apache.crail.conf.CrailConfiguration) CoreDataStore(org.apache.crail.core.CoreDataStore)

Example 2 with CoreDataStore

use of org.apache.crail.core.CoreDataStore in project incubator-crail by apache.

the class CrailFsck method namenodeDump.

public void namenodeDump() throws Exception {
    CrailConfiguration conf = new CrailConfiguration();
    CoreDataStore fs = new CoreDataStore(conf);
    fs.dumpNameNode();
    fs.close();
}
Also used : CrailConfiguration(org.apache.crail.conf.CrailConfiguration) CoreDataStore(org.apache.crail.core.CoreDataStore)

Example 3 with CoreDataStore

use of org.apache.crail.core.CoreDataStore 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)

Example 4 with CoreDataStore

use of org.apache.crail.core.CoreDataStore in project incubator-crail by apache.

the class CrailStore method newInstance.

public static CrailStore newInstance(CrailConfiguration conf) throws Exception {
    synchronized (referenceCounter) {
        boolean isSingleton = conf.getBoolean(CrailConstants.SINGLETON_KEY, false);
        if (isSingleton) {
            referenceCounter.incrementAndGet();
            if (instance == null) {
                LOG.info("creating singleton crail file system");
                instance = new CoreDataStore(conf);
                return instance;
            } else {
                LOG.info("returning singleton crail file system");
                return instance;
            }
        } else {
            LOG.info("creating non-singleton crail file system");
            return new CoreDataStore(conf);
        }
    }
}
Also used : CoreDataStore(org.apache.crail.core.CoreDataStore)

Aggregations

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