| Method from org.apache.hadoop.dfs.DistributedFileSystem Detail: |
public void close() throws IOException {
super.close();
dfs.close();
}
|
public FSDataOutputStream create(Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress) throws IOException {
if (exists(f) && !overwrite) {
throw new IOException("File already exists:"+f);
}
Path parent = f.getParent();
if (parent != null && !mkdirs(parent)) {
throw new IOException("Mkdirs failed to create " + parent);
}
return new FSDataOutputStream( dfs.create(getPath(f), overwrite,
replication, blockSize,
progress, bufferSize) );
}
|
public boolean delete(Path f) throws IOException {
return dfs.delete(getPath(f));
}
Get rid of Path f, whether a true file or dir. |
public UpgradeStatusReport distributedUpgradeProgress(UpgradeAction action) throws IOException {
return dfs.distributedUpgradeProgress(action);
}
|
public boolean exists(Path f) throws IOException {
return dfs.exists(getPath(f));
}
|
public void finalizeUpgrade() throws IOException {
dfs.finalizeUpgrade();
}
Finalize previously upgraded files system state. |
DFSClient getClient() {
return dfs;
}
|
public long getContentLength(Path f) throws IOException {
if (f instanceof DfsPath) {
return ((DfsPath)f).getContentsLength();
}
DFSFileInfo info[] = dfs.listPaths(getPath(f));
return (info == null) ? 0 : info[0].getLen();
}
|
public DatanodeInfo[] getDataNodeStats() throws IOException {
return dfs.datanodeReport();
}
Return statistics for each datanode. |
public long getDefaultBlockSize() {
return dfs.getDefaultBlockSize();
}
|
public short getDefaultReplication() {
return dfs.getDefaultReplication();
}
|
public String[][] getFileCacheHints(Path f,
long start,
long len) throws IOException {
return dfs.getHints(getPathName(f), start, len);
}
|
public FileStatus getFileStatus(Path f) throws IOException {
if (f instanceof DfsPath) {
DfsPath p = (DfsPath) f;
return p.info;
}
else {
DFSFileInfo p = dfs.getFileInfo(getPath(f));
return p;
}
}
Returns the stat information about the file. |
public String getName() {
return uri.getAuthority();
} Deprecated!
|
public long getRawCapacity() throws IOException {
return dfs.totalRawCapacity();
}
Return the total raw capacity of the filesystem, disregarding
replication . |
public long getRawUsed() throws IOException {
return dfs.totalRawUsed();
}
Return the total raw used space in the filesystem, disregarding
replication . |
public URI getUri() {
return uri;
}
|
public Path getWorkingDirectory() {
return workingDir;
}
|
public void initialize(URI uri,
Configuration conf) throws IOException {
setConf(conf);
String host = uri.getHost();
int port = uri.getPort();
this.dfs = new DFSClient(new InetSocketAddress(host, port), conf);
this.uri = URI.create("hdfs://"+host+":"+port);
this.localFs = getLocal(conf);
}
|
public Path[] listPaths(Path f) throws IOException {
DFSFileInfo info[] = dfs.listPaths(getPath(f));
if (info == null) {
return new Path[0];
} else {
Path results[] = new DfsPath[info.length];
for (int i = 0; i < info.length; i++) {
results[i] = new DfsPath(info[i], this);
}
return results;
}
}
|
public void lock(Path f,
boolean shared) throws IOException {
dfs.lock(getPath(f), !shared);
} Deprecated!
|
public void metaSave(String pathname) throws IOException {
dfs.metaSave(pathname);
}
|
public boolean mkdirs(Path f) throws IOException {
return dfs.mkdirs(getPath(f));
}
|
public FSDataInputStream open(Path f,
int bufferSize) throws IOException {
return new DFSClient.DFSDataInputStream(dfs.open(getPath(f),bufferSize));
}
|
public void refreshNodes() throws IOException {
dfs.refreshNodes();
}
|
public void release(Path f) throws IOException {
dfs.release(getPath(f));
} Deprecated!
|
public boolean rename(Path src,
Path dst) throws IOException {
return dfs.rename(getPath(src), getPath(dst));
}
|
public boolean reportChecksumFailure(Path f,
FSDataInputStream in,
long inPos,
FSDataInputStream sums,
long sumsPos) {
LocatedBlock lblocks[] = new LocatedBlock[2];
// Find block in data stream.
DFSClient.DFSDataInputStream dfsIn = (DFSClient.DFSDataInputStream) in;
Block dataBlock = dfsIn.getCurrentBlock();
if (dataBlock == null) {
LOG.error("Error: Current block in data stream is null! ");
return false;
}
DatanodeInfo[] dataNode = {dfsIn.getCurrentDatanode()};
lblocks[0] = new LocatedBlock(dataBlock, dataNode);
LOG.info("Found checksum error in data stream at block=" + dataBlock.getBlockName() +
" on datanode=" + dataNode[0].getName());
// Find block in checksum stream
DFSClient.DFSDataInputStream dfsSums = (DFSClient.DFSDataInputStream) sums;
Block sumsBlock = dfsSums.getCurrentBlock();
if (sumsBlock == null) {
LOG.error("Error: Current block in checksum stream is null! ");
return false;
}
DatanodeInfo[] sumsNode = {dfsSums.getCurrentDatanode()};
lblocks[1] = new LocatedBlock(sumsBlock, sumsNode);
LOG.info("Found checksum error in checksum stream at block=" + sumsBlock.getBlockName() +
" on datanode=" + sumsNode[0].getName());
// Ask client to delete blocks.
dfs.reportChecksumFailure(f.toString(), lblocks);
return true;
}
We need to find the blocks that didn't match. Likely only one
is corrupt but we will report both to the namenode. In the future,
we can consider figuring out exactly which block is corrupt. |
public boolean setReplication(Path src,
short replication) throws IOException {
return dfs.setReplication(getPath(src), replication);
}
|
public boolean setSafeMode(FSConstants.SafeModeAction action) throws IOException {
return dfs.setSafeMode(action);
}
Enter, leave or get safe mode. |
public void setWorkingDirectory(Path dir) {
Path result = makeAbsolute(dir);
if (!FSNamesystem.isValidName(result.toString())) {
throw new IllegalArgumentException("Invalid DFS directory name " +
result);
}
workingDir = makeAbsolute(dir);
}
|
public String toString() {
return "DFS[" + dfs + "]";
}
|