Save This Page
Home » hadoop-0.14.4 » org.apache » hadoop » dfs » [javadoc | source]
org.apache.hadoop.dfs
class: DFSClient [javadoc | source]
java.lang.Object
   org.apache.hadoop.dfs.DFSClient

All Implemented Interfaces:
    FSConstants

DFSClient can connect to a Hadoop Filesystem and perform basic file tasks. It uses the ClientProtocol to communicate with a NameNode daemon, and connects directly to DataNodes to read/write block data. Hadoop DFS users should obtain an instance of DistributedFileSystem, which uses DFSClient to handle filesystem tasks.
Nested Class Summary:
class  DFSClient.LeaseChecker  Periodically check in with the namenode and renew all the leases when the lease period is half over. 
static class  DFSClient.BlockReader  This is a wrapper around connection to datadone and understands checksum, offset etc 
class  DFSClient.DFSInputStream  DFSInputStream provides bytes from a named file. It handles negotiation of the namenode and various datanodes as necessary. 
static class  DFSClient.DFSDataInputStream   
class  DFSClient.DFSOutputStream  DFSOutputStream creates files from a stream of bytes. 
Field Summary
public static final  Log LOG     
static final  int MAX_BLOCK_ACQUIRE_FAILURES     
 ClientProtocol namenode     
 boolean running     
 Random r     
 String clientName     
 Daemon leaseChecker     
Constructor:
 public DFSClient(InetSocketAddress nameNodeAddr,
    Configuration conf) throws IOException 
    Create a new DFSClient connected to the given namenode server.
Method from org.apache.hadoop.dfs.DFSClient Summary:
close,   create,   create,   create,   create,   create,   datanodeReport,   delete,   distributedUpgradeProgress,   exists,   finalizeUpgrade,   getBlockSize,   getDefaultBlockSize,   getDefaultReplication,   getFileInfo,   getHints,   isDirectory,   listPaths,   lock,   metaSave,   mkdirs,   open,   open,   refreshNodes,   release,   rename,   reportBadBlocks,   reportChecksumFailure,   reportChecksumFailure,   setReplication,   setSafeMode,   totalRawCapacity,   totalRawUsed
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.hadoop.dfs.DFSClient Detail:
 public  void close() throws IOException 
    Close the file system, abadoning all of the leases and files being created.
 public OutputStream create(UTF8 src,
    boolean overwrite) throws IOException 
    Create a new dfs file and return an output stream for writing into it.
 public OutputStream create(UTF8 src,
    boolean overwrite,
    Progressable progress) throws IOException 
    Create a new dfs file and return an output stream for writing into it with write-progress reporting.
 public OutputStream create(UTF8 src,
    boolean overwrite,
    short replication,
    long blockSize) throws IOException 
    Create a new dfs file with the specified block replication and return an output stream for writing into the file.
 public OutputStream create(UTF8 src,
    boolean overwrite,
    short replication,
    long blockSize,
    Progressable progress) throws IOException 
    Create a new dfs file with the specified block replication with write-progress reporting and return an output stream for writing into the file.
 public OutputStream create(UTF8 src,
    boolean overwrite,
    short replication,
    long blockSize,
    Progressable progress,
    int buffersize) throws IOException 
    Create a new dfs file with the specified block replication with write-progress reporting and return an output stream for writing into the file.
 public DatanodeInfo[] datanodeReport() throws IOException 
 public boolean delete(UTF8 src) throws IOException 
    Make a direct connection to namenode and manipulate structures there.
 public UpgradeStatusReport distributedUpgradeProgress(UpgradeAction action) throws IOException 
 public boolean exists(UTF8 src) throws IOException 
 public  void finalizeUpgrade() throws IOException 
 public long getBlockSize(UTF8 f) throws IOException 
 public long getDefaultBlockSize() 
    Get the default block size for this cluster
 public short getDefaultReplication() 
 public DFSFileInfo getFileInfo(UTF8 src) throws IOException 
 public String[][] getHints(String src,
    long start,
    long length) throws IOException 
    Get hints about the location of the indicated block(s). getHints() returns a list of hostnames that store data for a specific file region. It returns a set of hostnames for every block within the indicated region. This function is very useful when writing code that considers data-placement when performing operations. For example, the MapReduce system tries to schedule tasks on the same machines as the data-block the task processes.
 public boolean isDirectory(UTF8 src) throws IOException 
 public DFSFileInfo[] listPaths(UTF8 src) throws IOException 
 public  void lock(UTF8 src,
    boolean exclusive) throws IOException 
 public  void metaSave(String pathname) throws IOException 
 public boolean mkdirs(UTF8 src) throws IOException 
 public DFSClient.DFSInputStream open(UTF8 src) throws IOException 
 public DFSClient.DFSInputStream open(UTF8 src,
    int buffersize) throws IOException 
    Create an input stream that obtains a nodelist from the namenode, and then reads from all the right places. Creates inner subclass of InputStream that does the right out-of-band work.
 public  void refreshNodes() throws IOException 
 public  void release(UTF8 src) throws IOException 
 public boolean rename(UTF8 src,
    UTF8 dst) throws IOException 
    Make a direct connection to namenode and manipulate structures there.
 public  void reportBadBlocks(LocatedBlock[] blocks) throws IOException 
    Report corrupt blocks that were discovered by the client.
  void reportChecksumFailure(String file,
    LocatedBlock[] lblocks) 
  void reportChecksumFailure(String file,
    Block blk,
    DatanodeInfo dn) 
 public boolean setReplication(UTF8 src,
    short replication) throws IOException 
    Set replication for an existing file.
 public boolean setSafeMode(SafeModeAction action) throws IOException 
 public long totalRawCapacity() throws IOException 
 public long totalRawUsed() throws IOException