use of org.apache.crail.CrailBlockLocation in project incubator-crail by apache.
the class CrailHDFS method getFileBlockLocations.
@Override
public BlockLocation[] getFileBlockLocations(Path path, long start, long len) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException {
try {
CrailBlockLocation[] _locations = dfs.lookup(path.toUri().getRawPath()).get().asFile().getBlockLocations(start, len);
BlockLocation[] locations = new BlockLocation[_locations.length];
for (int i = 0; i < locations.length; i++) {
locations[i] = new BlockLocation();
locations[i].setOffset(_locations[i].getOffset());
locations[i].setLength(_locations[i].getLength());
locations[i].setNames(_locations[i].getNames());
locations[i].setHosts(_locations[i].getHosts());
locations[i].setTopologyPaths(_locations[i].getTopology());
}
return locations;
} catch (Exception e) {
throw new IOException(e);
}
}
use of org.apache.crail.CrailBlockLocation in project incubator-crail by apache.
the class CrailFsck method getLocations.
public void getLocations(String filename, long offset, long length) throws Exception {
System.out.println("getLocations, filename " + filename + ", offset " + offset + ", len " + length);
CrailConfiguration conf = new CrailConfiguration();
CrailStore fs = CrailStore.newInstance(conf);
CrailBlockLocation[] locations = fs.lookup(filename).get().getBlockLocations(offset, length);
for (int i = 0; i < locations.length; i++) {
System.out.println("location " + i + " : " + locations[i].toString());
}
fs.close();
}
use of org.apache.crail.CrailBlockLocation in project incubator-crail by apache.
the class CrailHadoopFileSystem method getFileBlockLocations.
@Override
public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException {
try {
CrailBlockLocation[] _locations = dfs.lookup(file.getPath().toUri().getRawPath()).get().asFile().getBlockLocations(start, len);
BlockLocation[] locations = new BlockLocation[_locations.length];
for (int i = 0; i < locations.length; i++) {
locations[i] = new BlockLocation();
locations[i].setOffset(_locations[i].getOffset());
locations[i].setLength(_locations[i].getLength());
locations[i].setNames(_locations[i].getNames());
locations[i].setHosts(_locations[i].getHosts());
locations[i].setTopologyPaths(_locations[i].getTopology());
}
return locations;
} catch (Exception e) {
throw new IOException(e);
}
}
use of org.apache.crail.CrailBlockLocation in project incubator-crail by apache.
the class CrailHadoopFileSystem method getFileBlockLocations.
@Override
public BlockLocation[] getFileBlockLocations(Path path, long start, long len) throws IOException {
try {
CrailBlockLocation[] _locations = dfs.lookup(path.toUri().getRawPath()).get().asFile().getBlockLocations(start, len);
BlockLocation[] locations = new BlockLocation[_locations.length];
for (int i = 0; i < locations.length; i++) {
locations[i] = new BlockLocation();
locations[i].setOffset(_locations[i].getOffset());
locations[i].setLength(_locations[i].getLength());
locations[i].setNames(_locations[i].getNames());
locations[i].setHosts(_locations[i].getHosts());
locations[i].setTopologyPaths(_locations[i].getTopology());
}
return locations;
} catch (Exception e) {
throw new IOException(e);
}
}
Aggregations