use of org.apache.crail.rpc.RpcGetFile in project incubator-crail by apache.
the class CoreDataStore method lookup.
public Upcoming<CrailNode> lookup(String path) throws Exception {
FileName name = new FileName(path);
if (CrailConstants.DEBUG) {
LOG.info("lookupDirectory: path " + path);
}
RpcFuture<RpcGetFile> fileRes = rpcConnection.getFile(name, false);
return new LookupNodeFuture(this, path, fileRes);
}
use of org.apache.crail.rpc.RpcGetFile in project incubator-crail by apache.
the class CoreDataStore method _listEntries.
public DirectoryInputStream _listEntries(String name, boolean randomize) throws Exception {
FileName directory = new FileName(name);
if (CrailConstants.DEBUG) {
LOG.info("getDirectoryList: " + name);
}
RpcGetFile fileRes = rpcConnection.getFile(directory, false).get(CrailConstants.RPC_TIMEOUT, TimeUnit.MILLISECONDS);
if (fileRes.getError() != RpcErrors.ERR_OK) {
LOG.info("getDirectoryList: " + RpcErrors.messages[fileRes.getError()]);
throw new FileNotFoundException(RpcErrors.messages[fileRes.getError()]);
}
FileInfo dirInfo = fileRes.getFile();
if (!dirInfo.getType().isContainer()) {
LOG.info("getDirectoryList: " + RpcErrors.messages[RpcErrors.ERR_FILE_IS_NOT_DIR]);
throw new FileNotFoundException(RpcErrors.messages[RpcErrors.ERR_FILE_IS_NOT_DIR]);
}
CoreDirectory dirFile = new CoreDirectory(this, dirInfo, name);
DirectoryInputStream inputStream = dirFile.getDirectoryInputStream(randomize);
return inputStream;
}
Aggregations