|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.conf.Configured
org.apache.hadoop.fs.FileSystem
org.apache.hadoop.dfs.DistributedFileSystem
public class DistributedFileSystem
Implementation of the abstract FileSystem for the DFS system. This object is the way end-user code interacts with a Hadoop DistributedFileSystem.
Field Summary |
---|
Fields inherited from class org.apache.hadoop.fs.FileSystem |
---|
LOG |
Constructor Summary | |
---|---|
DistributedFileSystem(InetSocketAddress namenode,
Configuration conf)
Construct a client for the filesystem at namenode . |
Method Summary | |
---|---|
void |
close()
No more filesystem operations are needed. |
void |
completeLocalInput(File localFile)
We're done with the local stuff, so delete it |
void |
completeLocalOutput(File fsOutputFile,
File tmpLocalFile)
Move completed local data to DFS destination |
void |
copyFromLocalFile(File src,
File dst)
The src file is on the local disk. |
void |
copyToLocalFile(File src,
File dst)
The src file is under FS2, and the dst is on the local disk. |
FSOutputStream |
createRaw(File f,
boolean overwrite)
Opens an OutputStream at the indicated File. |
boolean |
deleteRaw(File f)
Get rid of File f, whether a true file or dir. |
boolean |
exists(File f)
Check if exists |
long |
getBlockSize()
Return the number of bytes that large input files should be optimally be split into to minimize i/o time. |
DataNodeReport[] |
getDataNodeStats()
Return statistics for each datanode. |
String[][] |
getFileCacheHints(File f,
long start,
long len)
Return a 2D array of size 1x1 or greater, containing hostnames where portions of the given file can be found. |
long |
getLength(File f)
The number of bytes in a file. |
String |
getName()
Returns a name for this filesystem, suitable to pass to FileSystem.getNamed(String,Configuration) . |
long |
getRawCapacity()
Return the total raw capacity of the filesystem, disregarding replication . |
long |
getRawUsed()
Return the total raw used space in the filesystem, disregarding replication . |
long |
getUsed()
Return the total size of all files in the filesystem. |
File |
getWorkingDirectory()
Get the current working directory for the given file system |
boolean |
isAbsolute(File f)
True iff the named path is absolute. |
boolean |
isDirectory(File f)
True iff the named path is a directory. |
File[] |
listFilesRaw(File f)
List files in a directory. |
void |
lock(File f,
boolean shared)
Obtain a lock on the given File |
void |
mkdirs(File f)
Make the given file and all non-existent parents into directories. |
void |
moveFromLocalFile(File src,
File dst)
The src file is on the local disk. |
FSInputStream |
openRaw(File f)
Opens an InputStream for the indicated File, whether local or via DFS. |
void |
release(File f)
Release the lock |
boolean |
renameRaw(File src,
File dst)
Rename files/dirs |
void |
reportChecksumFailure(File f,
FSInputStream in,
long start,
long length,
int crc)
Report a checksum error to the file system. |
void |
setWorkingDirectory(File dir)
Set the current working directory for the given file system. |
File |
startLocalInput(File fsInputFile,
File tmpLocalFile)
Fetch remote DFS file, place at tmpLocalFile |
File |
startLocalOutput(File fsOutputFile,
File tmpLocalFile)
Returns a local File that the user can write output to. |
String |
toString()
|
Methods inherited from class org.apache.hadoop.fs.FileSystem |
---|
create, create, createNewFile, delete, get, getChecksumFile, getNamed, isChecksumFile, isFile, listFiles, listFiles, open, open, parseArgs, rename |
Methods inherited from class org.apache.hadoop.conf.Configured |
---|
getConf, setConf |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DistributedFileSystem(InetSocketAddress namenode, Configuration conf) throws IOException
namenode
.
IOException
Method Detail |
---|
public String getName()
FileSystem
FileSystem.getNamed(String,Configuration)
.
getName
in class FileSystem
public File getWorkingDirectory()
FileSystem
getWorkingDirectory
in class FileSystem
public void setWorkingDirectory(File dir)
FileSystem
setWorkingDirectory
in class FileSystem
public String[][] getFileCacheHints(File f, long start, long len) throws IOException
FileSystem
getFileCacheHints
in class FileSystem
IOException
public FSInputStream openRaw(File f) throws IOException
FileSystem
openRaw
in class FileSystem
IOException
public FSOutputStream createRaw(File f, boolean overwrite) throws IOException
FileSystem
createRaw
in class FileSystem
f
- the file name to openoverwrite
- if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.
IOException
public boolean renameRaw(File src, File dst) throws IOException
renameRaw
in class FileSystem
IOException
public boolean deleteRaw(File f) throws IOException
deleteRaw
in class FileSystem
IOException
public boolean exists(File f) throws IOException
FileSystem
exists
in class FileSystem
IOException
public boolean isDirectory(File f) throws IOException
FileSystem
isDirectory
in class FileSystem
IOException
public boolean isAbsolute(File f)
FileSystem
isAbsolute
in class FileSystem
public long getLength(File f) throws IOException
FileSystem
getLength
in class FileSystem
IOException
public File[] listFilesRaw(File f) throws IOException
FileSystem
listFilesRaw
in class FileSystem
IOException
public void mkdirs(File f) throws IOException
FileSystem
mkdirs
in class FileSystem
IOException
public void lock(File f, boolean shared) throws IOException
FileSystem
lock
in class FileSystem
IOException
public void release(File f) throws IOException
FileSystem
release
in class FileSystem
IOException
public void moveFromLocalFile(File src, File dst) throws IOException
FileSystem
moveFromLocalFile
in class FileSystem
IOException
public void copyFromLocalFile(File src, File dst) throws IOException
FileSystem
copyFromLocalFile
in class FileSystem
IOException
public void copyToLocalFile(File src, File dst) throws IOException
FileSystem
copyToLocalFile
in class FileSystem
IOException
public File startLocalOutput(File fsOutputFile, File tmpLocalFile) throws IOException
FileSystem
startLocalOutput
in class FileSystem
IOException
public void completeLocalOutput(File fsOutputFile, File tmpLocalFile) throws IOException
completeLocalOutput
in class FileSystem
IOException
public File startLocalInput(File fsInputFile, File tmpLocalFile) throws IOException
startLocalInput
in class FileSystem
IOException
public void completeLocalInput(File localFile) throws IOException
completeLocalInput
in class FileSystem
IOException
public void close() throws IOException
FileSystem
close
in class FileSystem
IOException
public String toString()
toString
in class Object
public void reportChecksumFailure(File f, FSInputStream in, long start, long length, int crc)
FileSystem
reportChecksumFailure
in class FileSystem
f
- the file name containing the errorin
- the stream open on the filestart
- the position of the beginning of the bad data in the filelength
- the length of the bad data in the filecrc
- the expected CRC32 of the datapublic long getBlockSize()
FileSystem
getBlockSize
in class FileSystem
public long getRawCapacity() throws IOException
IOException
public long getRawUsed() throws IOException
IOException
public long getUsed() throws IOException
IOException
public DataNodeReport[] getDataNodeStats() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |