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.


Field Summary
static byte[] DOT_INODES
           
static String DOT_INODES_STRING
           
static byte[] DOT_RESERVED
           
static String DOT_RESERVED_PATH_PREFIX
           
static String DOT_RESERVED_STRING
           
 
Method Summary
 void addToInodeMap(org.apache.hadoop.hdfs.server.namenode.INode inode)
          This method is always called with writeLock of FSDirectory held.
 void close()
          Shutdown the filestore
 org.apache.hadoop.hdfs.server.namenode.INode getInode(long id)
          Get the inode from inodeMap based on its inode id.
 org.apache.hadoop.hdfs.server.namenode.INode getINode(String src)
          Get INode associated with the file / directory.
 org.apache.hadoop.hdfs.server.namenode.INode getINode4Write(String src)
          Get INode associated with the file / directory.
 INodeMap getINodeMap()
           
 INodesInPath getINodesInPath4Write(String src)
          Get INode associated with the file / directory.
 INodesInPath getLastINodeInPath(String src)
          Get INode associated with the file / directory.
 int getReadHoldCount()
           
 INodeDirectory getRoot()
           
 int getWriteHoldCount()
           
 long getYieldCount()
           
static boolean isReservedName(org.apache.hadoop.hdfs.server.namenode.INode inode)
          Check if a given inode name is reserved
static boolean isReservedName(String src)
          Check if a given path is reserved
 void removeFromInodeMap(List<? extends org.apache.hadoop.hdfs.server.namenode.INode> inodes)
          This method is always called with writeLock of FSDirectory held.
protected  void setReady(boolean flag)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOT_RESERVED_STRING

public static final String DOT_RESERVED_STRING
See Also:
Constant Field Values

DOT_RESERVED_PATH_PREFIX

public static final String DOT_RESERVED_PATH_PREFIX
See Also:
Constant Field Values

DOT_RESERVED

public static final byte[] DOT_RESERVED

DOT_INODES_STRING

public static final String DOT_INODES_STRING
See Also:
Constant Field Values

DOT_INODES

public static final byte[] DOT_INODES
Method Detail

getReadHoldCount

public int getReadHoldCount()

getWriteHoldCount

public int getWriteHoldCount()

getRoot

public INodeDirectory getRoot()
Returns:
the root directory inode.

setReady

protected void setReady(boolean flag)

close

public void close()
           throws IOException
Shutdown the filestore

Specified by:
close in interface Closeable
Throws:
IOException

getINode

public org.apache.hadoop.hdfs.server.namenode.INode getINode(String src)
                                                      throws org.apache.hadoop.fs.UnresolvedLinkException
Get INode associated with the file / directory.

Throws:
org.apache.hadoop.fs.UnresolvedLinkException

getLastINodeInPath

public INodesInPath getLastINodeInPath(String src)
                                throws org.apache.hadoop.fs.UnresolvedLinkException
Get INode associated with the file / directory.

Throws:
org.apache.hadoop.fs.UnresolvedLinkException

getINodesInPath4Write

public INodesInPath getINodesInPath4Write(String src)
                                   throws org.apache.hadoop.fs.UnresolvedLinkException,
                                          SnapshotAccessControlException
Get INode associated with the file / directory.

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

getINode4Write

public org.apache.hadoop.hdfs.server.namenode.INode getINode4Write(String src)
                                                            throws org.apache.hadoop.fs.UnresolvedLinkException,
                                                                   SnapshotAccessControlException
Get INode associated with the file / directory.

Throws:
SnapshotAccessControlException - if path is in RO snapshot
org.apache.hadoop.fs.UnresolvedLinkException

getYieldCount

public long getYieldCount()

getINodeMap

public INodeMap getINodeMap()

addToInodeMap

public final void addToInodeMap(org.apache.hadoop.hdfs.server.namenode.INode inode)
This method is always called with writeLock of FSDirectory held.


removeFromInodeMap

public final void removeFromInodeMap(List<? extends org.apache.hadoop.hdfs.server.namenode.INode> inodes)
This method is always called with writeLock of FSDirectory held.


getInode

public org.apache.hadoop.hdfs.server.namenode.INode getInode(long id)
Get the inode from inodeMap based on its inode id.

Parameters:
id - The given id
Returns:
The inode associated with the given id

isReservedName

public static boolean isReservedName(org.apache.hadoop.hdfs.server.namenode.INode inode)
Check if a given inode name is reserved


isReservedName

public static boolean isReservedName(String src)
Check if a given path is reserved



Copyright © 2014 Apache Software Foundation. All Rights Reserved.