org.apache.hadoop.hdfs.server.namenode
Class FSDirectory

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.namenode.FSDirectory
All Implemented Interfaces:
Closeable

public class FSDirectory
extends Object
implements Closeable

FSDirectory stores the filesystem directory state. It handles writing/loading values to disk, and logging changes as we go. It keeps the filename->blockset mapping always-current and logged to disk.


Method Summary
 void close()
          Shutdown the filestore
 void concat(String target, String[] srcs)
          Concat all the blocks from srcs to trg and delete the srcs files
 void replaceNode(String path, org.apache.hadoop.hdfs.server.namenode.INodeFile oldnode, org.apache.hadoop.hdfs.server.namenode.INodeFile newnode)
          Replaces the specified inode with the specified one.
protected  void setReady(boolean flag)
           
 void unprotectedConcat(String target, String[] srcs, long timestamp)
          Concat all the blocks from srcs to trg and delete the srcs files
protected
<T extends org.apache.hadoop.hdfs.server.namenode.INode>
void
verifyFsLimits(org.apache.hadoop.hdfs.server.namenode.INode[] pathComponents, int pos, T child)
          Verify that filesystem limit constraints are not violated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setReady

protected void setReady(boolean flag)

close

public void close()
           throws IOException
Shutdown the filestore

Specified by:
close in interface Closeable
Throws:
IOException

concat

public void concat(String target,
                   String[] srcs)
            throws org.apache.hadoop.fs.UnresolvedLinkException
Concat all the blocks from srcs to trg and delete the srcs files

Throws:
org.apache.hadoop.fs.UnresolvedLinkException

unprotectedConcat

public void unprotectedConcat(String target,
                              String[] srcs,
                              long timestamp)
                       throws org.apache.hadoop.fs.UnresolvedLinkException
Concat all the blocks from srcs to trg and delete the srcs files

Parameters:
target - target file to move the blocks to
srcs - list of file to move the blocks from Must be public because also called from EditLogs NOTE: - it does not update quota (not needed for concat)
Throws:
org.apache.hadoop.fs.UnresolvedLinkException

replaceNode

public void replaceNode(String path,
                        org.apache.hadoop.hdfs.server.namenode.INodeFile oldnode,
                        org.apache.hadoop.hdfs.server.namenode.INodeFile newnode)
                 throws IOException,
                        org.apache.hadoop.fs.UnresolvedLinkException
Replaces the specified inode with the specified one.

Throws:
IOException
org.apache.hadoop.fs.UnresolvedLinkException

verifyFsLimits

protected <T extends org.apache.hadoop.hdfs.server.namenode.INode> void verifyFsLimits(org.apache.hadoop.hdfs.server.namenode.INode[] pathComponents,
                                                                                       int pos,
                                                                                       T child)
                       throws org.apache.hadoop.hdfs.protocol.FSLimitException
Verify that filesystem limit constraints are not violated

Throws:
FSLimitException.PathComponentTooLongException - child's name is too long
FSLimitException.MaxDirectoryItemsExceededException - items per directory is exceeded
org.apache.hadoop.hdfs.protocol.FSLimitException


Copyright © 2013 Apache Software Foundation. All Rights Reserved.