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();
}
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();
}
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();
}
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);
}
}
}
Aggregations