|
||||||||||
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 |
completeLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
Move completed local data to DFS destination |
void |
copyFromLocalFile(Path src,
Path dst)
The src file is on the local disk. |
void |
copyToLocalFile(Path src,
Path dst)
The src file is under FS, and the dst is on the local disk. |
FSOutputStream |
createRaw(Path f,
boolean overwrite,
short replication,
long blockSize)
Opens an OutputStream at the indicated Path. |
FSOutputStream |
createRaw(Path f,
boolean overwrite,
short replication,
long blockSize,
Progressable progress)
Opens an OutputStream at the indicated Path with write-progress reporting. |
boolean |
deleteRaw(Path f)
Get rid of Path f, whether a true file or dir. |
boolean |
exists(Path f)
Check if exists. |
long |
getBlockSize(Path f)
Get the size for a particular file. |
DatanodeInfo[] |
getDataNodeStats()
Return statistics for each datanode. |
long |
getDefaultBlockSize()
Return the number of bytes that large input files should be optimally be split into to minimize i/o time. |
short |
getDefaultReplication()
Get the default replication. |
String[][] |
getFileCacheHints(Path 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(Path 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 . |
short |
getReplication(Path f)
Get replication. |
long |
getUsed()
Return the total size of all files in the filesystem. |
Path |
getWorkingDirectory()
Get the current working directory for the given file system |
boolean |
isDirectory(Path f)
True iff the named path is a directory. |
Path[] |
listPathsRaw(Path f)
List files in a directory. |
void |
lock(Path f,
boolean shared)
Obtain a lock on the given Path |
boolean |
mkdirs(Path f)
Make the given file and all non-existent parents into directories. |
void |
moveFromLocalFile(Path src,
Path dst)
The src file is on the local disk. |
FSInputStream |
openRaw(Path f)
Opens an InputStream for the indicated Path, whether local or via DFS. |
void |
release(Path f)
Release the lock |
boolean |
renameRaw(Path src,
Path dst)
Rename files/dirs |
void |
reportChecksumFailure(Path f,
FSInputStream in,
long start,
long length,
int crc)
Report a checksum error to the file system. |
boolean |
setReplicationRaw(Path src,
short replication)
Set replication for an existing file. |
boolean |
setSafeMode(FSConstants.SafeModeAction action)
Enter, leave or get safe mode. |
void |
setWorkingDirectory(Path dir)
Set the current working directory for the given file system. |
Path |
startLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
Returns a local File that the user can write output to. |
String |
toString()
|
Methods inherited from class org.apache.hadoop.fs.FileSystem |
---|
completeLocalOutput, create, create, create, create, create, create, create, create, create, createNewFile, createNewFile, delete, delete, exists, get, getChecksumFile, getLength, getNamed, globPaths, globPaths, isChecksumFile, isDirectory, isFile, isFile, listFiles, listFiles, listPaths, listPaths, listPaths, listPaths, lock, mkdirs, open, open, open, parseArgs, release, rename, rename, setReplication, startLocalOutput |
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 Path getWorkingDirectory()
FileSystem
getWorkingDirectory
in class FileSystem
public long getDefaultBlockSize()
FileSystem
getDefaultBlockSize
in class FileSystem
public long getBlockSize(Path f) throws IOException
FileSystem
getBlockSize
in class FileSystem
f
- the filename
IOException
public short getDefaultReplication()
FileSystem
getDefaultReplication
in class FileSystem
public void setWorkingDirectory(Path dir)
FileSystem
setWorkingDirectory
in class FileSystem
public String[][] getFileCacheHints(Path f, long start, long len) throws IOException
FileSystem
getFileCacheHints
in class FileSystem
IOException
public FSInputStream openRaw(Path f) throws IOException
FileSystem
openRaw
in class FileSystem
IOException
public FSOutputStream createRaw(Path f, boolean overwrite, short replication, long blockSize) 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.replication
- required block replication for the file.
IOException
public FSOutputStream createRaw(Path f, boolean overwrite, short replication, long blockSize, Progressable progress) 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.replication
- required block replication for the file.
IOException
public boolean setReplicationRaw(Path src, short replication) throws IOException
FileSystem
setReplicationRaw
in class FileSystem
src
- file namereplication
- new replication
IOException
public boolean renameRaw(Path src, Path dst) throws IOException
renameRaw
in class FileSystem
IOException
public boolean deleteRaw(Path f) throws IOException
deleteRaw
in class FileSystem
IOException
public boolean exists(Path f) throws IOException
FileSystem
exists
in class FileSystem
IOException
public boolean isDirectory(Path f) throws IOException
FileSystem
isDirectory
in class FileSystem
IOException
public long getLength(Path f) throws IOException
FileSystem
getLength
in class FileSystem
IOException
public short getReplication(Path f) throws IOException
FileSystem
getReplication
in class FileSystem
f
- file name
IOException
public Path[] listPathsRaw(Path f) throws IOException
FileSystem
listPathsRaw
in class FileSystem
IOException
public boolean mkdirs(Path f) throws IOException
FileSystem
mkdirs
in class FileSystem
IOException
public void lock(Path f, boolean shared) throws IOException
FileSystem
lock
in class FileSystem
IOException
public void release(Path f) throws IOException
FileSystem
release
in class FileSystem
IOException
public void moveFromLocalFile(Path src, Path dst) throws IOException
FileSystem
moveFromLocalFile
in class FileSystem
IOException
public void copyFromLocalFile(Path src, Path dst) throws IOException
FileSystem
copyFromLocalFile
in class FileSystem
IOException
public void copyToLocalFile(Path src, Path dst) throws IOException
FileSystem
copyToLocalFile
in class FileSystem
IOException
public Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException
FileSystem
startLocalOutput
in class FileSystem
IOException
public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException
completeLocalOutput
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(Path 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 getRawCapacity() throws IOException
IOException
public long getRawUsed() throws IOException
IOException
public long getUsed() throws IOException
IOException
public DatanodeInfo[] getDataNodeStats() throws IOException
IOException
public boolean setSafeMode(FSConstants.SafeModeAction action) throws IOException
ClientProtocol#setSafeMode(FSConstants.SafeModeAction)
for more details.
IOException
ClientProtocol#setSafeMode(FSConstants.SafeModeAction)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |