java.io.Closeable, java.lang.AutoCloseable@Private
public class FSDirectory
extends java.lang.Object
implements java.io.Closeable
FSNamesystem| Modifier and Type | Class | Description |
|---|---|---|
static class |
FSDirectory.DirOp |
| Modifier and Type | Field | Description |
|---|---|---|
static byte[] |
DOT_INODES |
|
static java.lang.String |
DOT_INODES_STRING |
|
static byte[] |
DOT_RESERVED |
|
static java.lang.String |
DOT_RESERVED_PATH_PREFIX |
|
static org.apache.hadoop.hdfs.protocol.HdfsFileStatus |
DOT_RESERVED_STATUS |
|
static java.lang.String |
DOT_RESERVED_STRING |
|
static org.apache.hadoop.hdfs.protocol.HdfsFileStatus |
DOT_SNAPSHOT_DIR_STATUS |
|
EncryptionZoneManager |
ezManager |
| Modifier and Type | Method | Description |
|---|---|---|
INodesInPath |
addLastINode(INodesInPath existing,
INode inode,
org.apache.hadoop.fs.permission.FsPermission modes,
boolean checkQuota) |
Add a child to the end of the path specified by INodesInPath.
|
void |
addRootDirToEncryptionZone(XAttrFeature xaf) |
This is to handle encryption zone for rootDir when loading from
fsimage, and should only be called during NN restart.
|
void |
addToInodeMap(INode inode) |
This method is always called with writeLock of FSDirectory held.
|
void |
close() |
Shutdown the filestore
|
BlockStoragePolicySuite |
getBlockStoragePolicySuite() |
|
INode |
getInode(long id) |
Get the inode from inodeMap based on its inode id.
|
INode |
getINode(java.lang.String src) |
Get
INode associated with the file / directory. |
INode |
getINode(java.lang.String src,
FSDirectory.DirOp dirOp) |
Get
INode associated with the file / directory. |
INode |
getINode4Write(java.lang.String src) |
Get
INode associated with the file / directory. |
INodeMap |
getINodeMap() |
|
INodesInPath |
getINodesInPath(byte[][] components,
FSDirectory.DirOp dirOp) |
|
INodesInPath |
getINodesInPath(java.lang.String src,
FSDirectory.DirOp dirOp) |
Resolves the given path into inodes.
|
long |
getLastInodeId() |
|
int |
getListLimit() |
|
static byte[][] |
getPathComponents(INode inode) |
Given an INode get all the path complents leading to it from the root.
|
java.util.SortedSet<java.lang.String> |
getProtectedDirectories() |
|
int |
getReadHoldCount() |
Deprecated.
|
INodeDirectory |
getRoot() |
|
EnumCounters<org.apache.hadoop.fs.StorageType> |
getStorageTypeDeltas(byte storagePolicyID,
long dsDelta,
short oldRep,
short newRep) |
|
int |
getWriteHoldCount() |
Deprecated.
|
long |
getYieldCount() |
|
static boolean |
isExactReservedName(byte[][] components) |
|
static boolean |
isExactReservedName(java.lang.String src) |
|
boolean |
isImageLoaded() |
Indicates whether the image loading is complete or not.
|
boolean |
isNonEmptyDirectory(INodesInPath inodesInPath) |
|
boolean |
isPosixAclInheritanceEnabled() |
|
boolean |
isProtectedSubDirectoriesEnable() |
|
static boolean |
isReservedName(java.lang.String src) |
Check if a given path is reserved
|
static boolean |
isReservedName(INode inode) |
Check if a given inode name is reserved
|
void |
removeFromInodeMap(java.util.List<? extends INode> inodes) |
This method is always called with writeLock of FSDirectory held.
|
long |
removeLastINode(INodesInPath iip) |
Remove the last inode in the path from the namespace.
|
INodesInPath |
resolvePath(FSPermissionChecker pc,
java.lang.String src,
FSDirectory.DirOp dirOp) |
Resolves a given path into an INodesInPath.
|
void |
setINodeAttributeProvider(INodeAttributeProvider provider) |
|
void |
setPosixAclInheritanceEnabled(boolean posixAclInheritanceEnabled) |
|
INodesInPath |
unprotectedResolvePath(java.lang.String src) |
This method should only be used from internal paths and not those provided
directly by a user.
|
void |
updateCount(INodesInPath iip,
INode.QuotaDelta quotaDelta,
boolean check) |
|
void |
updateSpaceForCompleteBlock(BlockInfo completeBlk,
INodesInPath inodes) |
Update the cached quota space for a block that is being completed.
|
public static final java.lang.String DOT_RESERVED_STRING
public static final java.lang.String DOT_RESERVED_PATH_PREFIX
public static final byte[] DOT_RESERVED
public static final java.lang.String DOT_INODES_STRING
public static final byte[] DOT_INODES
public static final org.apache.hadoop.hdfs.protocol.HdfsFileStatus DOT_RESERVED_STATUS
public static final org.apache.hadoop.hdfs.protocol.HdfsFileStatus DOT_SNAPSHOT_DIR_STATUS
@VisibleForTesting public final EncryptionZoneManager ezManager
public void setINodeAttributeProvider(@Nullable
INodeAttributeProvider provider)
@Deprecated public int getReadHoldCount()
@Deprecated public int getWriteHoldCount()
public int getListLimit()
public boolean isImageLoaded()
public java.util.SortedSet<java.lang.String> getProtectedDirectories()
public boolean isProtectedSubDirectoriesEnable()
public INodeDirectory getRoot()
public BlockStoragePolicySuite getBlockStoragePolicySuite()
@VisibleForTesting public boolean isPosixAclInheritanceEnabled()
@VisibleForTesting public void setPosixAclInheritanceEnabled(boolean posixAclInheritanceEnabled)
public void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOException@VisibleForTesting public INodesInPath resolvePath(FSPermissionChecker pc, java.lang.String src, FSDirectory.DirOp dirOp) throws org.apache.hadoop.fs.UnresolvedLinkException, java.io.FileNotFoundException, org.apache.hadoop.security.AccessControlException, org.apache.hadoop.fs.ParentNotDirectoryException
pc - A permission checker for traversal checks. Pass null for
no permission checks.src - The path to resolve.dirOp - The FSDirectory.DirOp that controls additional checks.<inodeid> with the corresponding path of the inode, else
the path in src as is. If the path refers to a path in
the "raw" directory, return the non-raw pathname.java.io.FileNotFoundExceptionorg.apache.hadoop.security.AccessControlExceptionorg.apache.hadoop.fs.ParentNotDirectoryExceptionorg.apache.hadoop.fs.UnresolvedLinkExceptionpublic INodesInPath unprotectedResolvePath(java.lang.String src) throws java.io.FileNotFoundException
src - The path to resolve.<inodeid> with the corresponding path of the inode, else
the path in src as is. If the path refers to a path in
the "raw" directory, return the non-raw pathname.java.io.FileNotFoundExceptionpublic boolean isNonEmptyDirectory(INodesInPath inodesInPath)
public void updateCount(INodesInPath iip, INode.QuotaDelta quotaDelta, boolean check) throws org.apache.hadoop.hdfs.protocol.QuotaExceededException
org.apache.hadoop.hdfs.protocol.QuotaExceededExceptionpublic void updateSpaceForCompleteBlock(BlockInfo completeBlk, INodesInPath inodes) throws java.io.IOException
completeBlk - - Completed block for which to update spaceinodes - - INodes in path to file containing completeBlk; if null
this will be resolved internallyjava.io.IOExceptionpublic EnumCounters<org.apache.hadoop.fs.StorageType> getStorageTypeDeltas(byte storagePolicyID, long dsDelta, short oldRep, short newRep)
@VisibleForTesting public INodesInPath addLastINode(INodesInPath existing, INode inode, org.apache.hadoop.fs.permission.FsPermission modes, boolean checkQuota) throws org.apache.hadoop.hdfs.protocol.QuotaExceededException
existing - the INodesInPath containing all the ancestral INodesinode - the new INode to addmodes - create modescheckQuota - whether to check quotaorg.apache.hadoop.hdfs.protocol.QuotaExceededException@VisibleForTesting public long removeLastINode(INodesInPath iip)
@VisibleForTesting public long getYieldCount()
public INodeMap getINodeMap()
public final void addToInodeMap(INode inode)
public final void addRootDirToEncryptionZone(XAttrFeature xaf)
public final void removeFromInodeMap(java.util.List<? extends INode> inodes)
public INode getInode(long id)
id - The given idpublic static byte[][] getPathComponents(INode inode)
public static boolean isReservedName(INode inode)
public static boolean isReservedName(java.lang.String src)
public static boolean isExactReservedName(java.lang.String src)
public static boolean isExactReservedName(byte[][] components)
public INodesInPath getINodesInPath(java.lang.String src, FSDirectory.DirOp dirOp) throws org.apache.hadoop.fs.UnresolvedLinkException, org.apache.hadoop.security.AccessControlException, org.apache.hadoop.fs.ParentNotDirectoryException
resolvePath(FSPermissionChecker, String, DirOp).
This method should only be used by internal methods.INodesInPath containing all inodes in the path.org.apache.hadoop.fs.UnresolvedLinkExceptionorg.apache.hadoop.fs.ParentNotDirectoryExceptionorg.apache.hadoop.security.AccessControlExceptionpublic INodesInPath getINodesInPath(byte[][] components, FSDirectory.DirOp dirOp) throws org.apache.hadoop.fs.UnresolvedLinkException, org.apache.hadoop.security.AccessControlException, org.apache.hadoop.fs.ParentNotDirectoryException
org.apache.hadoop.fs.UnresolvedLinkExceptionorg.apache.hadoop.security.AccessControlExceptionorg.apache.hadoop.fs.ParentNotDirectoryException@VisibleForTesting public INode getINode(java.lang.String src) throws org.apache.hadoop.fs.UnresolvedLinkException, org.apache.hadoop.security.AccessControlException, org.apache.hadoop.fs.ParentNotDirectoryException
INode associated with the file / directory.
See getINode(String, DirOp)org.apache.hadoop.fs.UnresolvedLinkExceptionorg.apache.hadoop.security.AccessControlExceptionorg.apache.hadoop.fs.ParentNotDirectoryException@VisibleForTesting public INode getINode4Write(java.lang.String src) throws org.apache.hadoop.fs.UnresolvedLinkException, org.apache.hadoop.security.AccessControlException, java.io.FileNotFoundException, org.apache.hadoop.fs.ParentNotDirectoryException
INode associated with the file / directory.
See getINode(String, DirOp)org.apache.hadoop.fs.UnresolvedLinkExceptionorg.apache.hadoop.security.AccessControlExceptionjava.io.FileNotFoundExceptionorg.apache.hadoop.fs.ParentNotDirectoryExceptionpublic INode getINode(java.lang.String src, FSDirectory.DirOp dirOp) throws org.apache.hadoop.fs.UnresolvedLinkException, org.apache.hadoop.security.AccessControlException, org.apache.hadoop.fs.ParentNotDirectoryException
INode associated with the file / directory.org.apache.hadoop.fs.UnresolvedLinkExceptionorg.apache.hadoop.security.AccessControlExceptionorg.apache.hadoop.fs.ParentNotDirectoryExceptionpublic long getLastInodeId()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.