java.lang.Comparable<byte[]>, INodeAttributes, Diff.Element<byte[]>INodeReference, INodeWithAdditionalFields@Private public abstract class INode extends java.lang.Object implements INodeAttributes, Diff.Element<byte[]>
| Modifier and Type | Class | Description |
|---|---|---|
static class |
INode.BlocksMapUpdateInfo |
Information used for updating the blocksMap when deleting files.
|
static interface |
INode.Feature |
INode feature such as
FileUnderConstructionFeature
and DirectoryWithQuotaFeature. |
static class |
INode.QuotaDelta |
Information used to record quota usage delta.
|
static class |
INode.ReclaimContext |
Context object to record blocks and inodes that need to be reclaimed
|
INodeAttributes.SnapshotCopy| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
| Modifier and Type | Method | Description |
|---|---|---|
void |
accept(NamespaceVisitor visitor,
int snapshot) |
Accept a visitor to visit this
INode. |
void |
addSpaceConsumed(QuotaCounts counts) |
Check and add namespace/storagespace/storagetype consumed to itself and the ancestors.
|
INodeDirectory |
asDirectory() |
Cast this inode to an
INodeDirectory. |
INodeFile |
asFile() |
Cast this inode to an
INodeFile. |
INodeReference |
asReference() |
Cast this inode to an
INodeReference. |
INodeSymlink |
asSymlink() |
Cast this inode to an
INodeSymlink. |
abstract void |
cleanSubtree(INode.ReclaimContext reclaimContext,
int snapshotId,
int priorSnapshotId) |
Clean the subtree under this inode and collect the blocks from the descents
for further block deletion/update.
|
void |
clear() |
Clear references to other objects.
|
int |
compareTo(byte[] bytes) |
|
org.apache.hadoop.fs.ContentSummary |
computeAndConvertContentSummary(int snapshotId,
ContentSummaryComputationContext summary) |
Compute
ContentSummary. |
abstract ContentSummaryComputationContext |
computeContentSummary(int snapshotId,
ContentSummaryComputationContext summary) |
Count subtree content summary with a
ContentCounts. |
org.apache.hadoop.fs.ContentSummary |
computeContentSummary(BlockStoragePolicySuite bsps) |
Compute
ContentSummary. |
QuotaCounts |
computeQuotaUsage(BlockStoragePolicySuite bsps) |
Count subtree
Quota.NAMESPACE and Quota.STORAGESPACE usages. |
QuotaCounts |
computeQuotaUsage(BlockStoragePolicySuite bsps,
boolean useCache) |
|
abstract QuotaCounts |
computeQuotaUsage(BlockStoragePolicySuite bsps,
byte blockStoragePolicyId,
boolean useCache,
int lastSnapshotId) |
Count subtree
Quota.NAMESPACE and Quota.STORAGESPACE usages. |
abstract void |
destroyAndCollectBlocks(INode.ReclaimContext reclaimContext) |
Destroy self and clear everything! If the INode is a file, this method
collects its blocks for further block deletion.
|
void |
dumpINode(java.io.PrintWriter out,
java.lang.StringBuilder prefix,
int snapshotId) |
|
java.lang.StringBuilder |
dumpParentINodes() |
|
java.lang.StringBuffer |
dumpTreeRecursively() |
Dump the subtree starting from this inode.
|
void |
dumpTreeRecursively(java.io.PrintStream out) |
|
void |
dumpTreeRecursively(java.io.PrintWriter out,
java.lang.StringBuilder prefix,
int snapshotId) |
Dump tree recursively.
|
boolean |
equals(java.lang.Object that) |
|
long |
getAccessTime() |
The same as getAccessTime(Snapshot.CURRENT_STATE_ID).
|
AclFeature |
getAclFeature() |
|
org.apache.hadoop.fs.permission.FsPermission |
getFsPermission() |
The same as getFsPermission(Snapshot.CURRENT_STATE_ID).
|
java.lang.String |
getFullPathAndObjectString() |
|
java.lang.String |
getFullPathName() |
|
java.lang.String |
getGroupName() |
The same as getGroupName(Snapshot.CURRENT_STATE_ID).
|
abstract long |
getId() |
Get inode id
|
byte[] |
getKey() |
|
java.lang.String |
getLocalName() |
|
abstract byte |
getLocalStoragePolicyID() |
|
long |
getModificationTime() |
The same as getModificationTime(Snapshot.CURRENT_STATE_ID).
|
java.lang.String |
getObjectString() |
|
INodeDirectory |
getParent() |
|
INodeReference |
getParentReference() |
|
java.lang.String |
getParentString() |
|
byte[][] |
getPathComponents() |
|
static byte[][] |
getPathComponents(java.lang.String path) |
Breaks
path into components. |
static java.lang.String[] |
getPathNames(java.lang.String path) |
Splits an absolute
path into an array of path components. |
abstract org.apache.hadoop.fs.permission.PermissionStatus |
getPermissionStatus(int snapshotId) |
Get the
PermissionStatus |
QuotaCounts |
getQuotaCounts() |
Get the quota set for this inode
|
INodeAttributes |
getSnapshotINode(int snapshotId) |
|
abstract byte |
getStoragePolicyID() |
|
byte |
getStoragePolicyIDForQuota(byte parentStoragePolicyId) |
Get the storage policy ID while computing quota usage
|
java.lang.String |
getUserName() |
The same as getUserName(Snapshot.CURRENT_STATE_ID).
|
XAttrFeature |
getXAttrFeature() |
|
int |
hashCode() |
|
boolean |
isAncestorDirectory(INodeDirectory dir) |
|
boolean |
isDeleted() |
|
boolean |
isDirectory() |
Check whether it's a directory
|
boolean |
isFile() |
Check whether it's a file.
|
boolean |
isInCurrentState() |
Is this inode in the current state?
|
boolean |
isInLatestSnapshot(int latestSnapshotId) |
Is this inode in the latest snapshot?
|
boolean |
isLastReference() |
|
boolean |
isQuotaSet() |
|
boolean |
isReference() |
Check whether it's a reference.
|
boolean |
isSetStoragePolicy() |
Check if this inode itself has a storage policy set.
|
boolean |
isSymlink() |
Check whether it's a symlink
|
abstract void |
setAccessTime(long accessTime) |
Set last access time of inode.
|
INode |
setAccessTime(long accessTime,
int latestSnapshotId,
boolean skipCaptureAccessTimeOnlyChangeInSnapshot) |
Set last access time of inode.
|
abstract void |
setLocalName(byte[] name) |
Set local file name
|
abstract void |
setModificationTime(long modificationTime) |
Set the last modification time of inode.
|
INode |
setModificationTime(long modificationTime,
int latestSnapshotId) |
Set the last modification time of inode.
|
void |
setParent(INodeDirectory parent) |
Set parent directory
|
void |
setParentReference(INodeReference parent) |
Set container.
|
boolean |
shouldRecordInSrcSnapshot(int latestInDst) |
When
recordModification(int) is called on a referred node,
this method tells which snapshot the modification should be
associated with: the snapshot that belongs to the SRC tree of the rename
operation, or the snapshot belonging to the DST tree. |
java.lang.String |
toDetailString() |
|
java.lang.String |
toString() |
|
abstract INode |
updateModificationTime(long mtime,
int latestSnapshotId) |
Update modification time if it is larger than the current value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetFsPermissionShort, getLocalNameBytes, getPermissionLongpublic abstract long getId()
public abstract org.apache.hadoop.fs.permission.PermissionStatus getPermissionStatus(int snapshotId)
PermissionStatuspublic final java.lang.String getUserName()
getUserName in interface INodeAttributespublic final java.lang.String getGroupName()
getGroupName in interface INodeAttributespublic final org.apache.hadoop.fs.permission.FsPermission getFsPermission()
getFsPermission in interface INodeAttributespublic final AclFeature getAclFeature()
getAclFeature in interface INodeAttributespublic final XAttrFeature getXAttrFeature()
getXAttrFeature in interface INodeAttributespublic INodeAttributes getSnapshotINode(int snapshotId)
Snapshot.CURRENT_STATE_ID,
return this; otherwise return the corresponding snapshot inode.public boolean isInCurrentState()
public final boolean isInLatestSnapshot(int latestSnapshotId)
public final boolean isAncestorDirectory(INodeDirectory dir)
public final boolean shouldRecordInSrcSnapshot(int latestInDst)
recordModification(int) is called on a referred node,
this method tells which snapshot the modification should be
associated with: the snapshot that belongs to the SRC tree of the rename
operation, or the snapshot belonging to the DST tree.latestInDst - id of the latest snapshot in the DST tree above the reference nodepublic boolean isReference()
public INodeReference asReference()
INodeReference.public boolean isFile()
public boolean isSetStoragePolicy()
public boolean isDirectory()
isDirectory in interface INodeAttributespublic INodeDirectory asDirectory()
INodeDirectory.public boolean isSymlink()
public INodeSymlink asSymlink()
INodeSymlink.public abstract void cleanSubtree(INode.ReclaimContext reclaimContext, int snapshotId, int priorSnapshotId)
In general, we have the following rules. 1. When deleting a file/directory in the current tree, we have different actions according to the type of the node to delete. 1.1 The current inode (this) is anINodeFile. 1.1.1 Ifprioris null, there is no snapshot taken on ancestors before. Thus we simply destroy (i.e., to delete completely, no need to save snapshot copy) the current INode and collect its blocks for further cleansing. 1.1.2 Else do nothing since the current INode will be stored as a snapshot copy. 1.2 The current inode is anINodeDirectory. 1.2.1 Ifprioris null, there is no snapshot taken on ancestors before. Similarly, we destroy the whole subtree and collect blocks. 1.2.2 Else do nothing with the current INode. Recursively clean its children. 1.3 The current inode is a file with snapshot. Call recordModification(..) to capture the current states. Mark the INode as deleted. 1.4 The current inode is anINodeDirectorywith snapshot feature. Call recordModification(..) to capture the current states. Destroy files/directories created after the latest snapshot (i.e., the inodes stored in the created list of the latest snapshot). Recursively clean remaining children. 2. When deleting a snapshot. 2.1 To cleanINodeFile: do nothing. 2.2 To cleanINodeDirectory: recursively clean its children. 2.3 To clean INodeFile with snapshot: delete the corresponding snapshot in its diff list. 2.4 To cleanINodeDirectorywith snapshot: delete the corresponding snapshot in its diff list. Recursively clean its children.
reclaimContext - Record blocks and inodes that need to be reclaimed.snapshotId - The id of the snapshot to delete.
Snapshot.CURRENT_STATE_ID means to delete the current
file/directory.priorSnapshotId - The id of the latest snapshot before the to-be-deleted snapshot.
When deleting a current inode, this parameter captures the latest
snapshot.public abstract void destroyAndCollectBlocks(INode.ReclaimContext reclaimContext)
reclaimContext - Record blocks and inodes that need to be reclaimed.public final org.apache.hadoop.fs.ContentSummary computeContentSummary(BlockStoragePolicySuite bsps) throws org.apache.hadoop.security.AccessControlException
ContentSummary. Blocking callorg.apache.hadoop.security.AccessControlExceptionpublic final org.apache.hadoop.fs.ContentSummary computeAndConvertContentSummary(int snapshotId,
ContentSummaryComputationContext summary)
throws org.apache.hadoop.security.AccessControlException
ContentSummary.org.apache.hadoop.security.AccessControlExceptionpublic abstract ContentSummaryComputationContext computeContentSummary(int snapshotId, ContentSummaryComputationContext summary) throws org.apache.hadoop.security.AccessControlException
ContentCounts.snapshotId - Specify the time range for the calculation. If this
parameter equals to Snapshot.CURRENT_STATE_ID,
the result covers both the current states and all the
snapshots. Otherwise the result only covers all the
files/directories contained in the specific snapshot.summary - the context object holding counts for the subtree.org.apache.hadoop.security.AccessControlExceptionpublic void addSpaceConsumed(QuotaCounts counts)
public QuotaCounts getQuotaCounts()
public final boolean isQuotaSet()
public final QuotaCounts computeQuotaUsage(BlockStoragePolicySuite bsps)
Quota.NAMESPACE and Quota.STORAGESPACE usages.
Entry point for FSDirectory where blockStoragePolicyId is given its initial
value.public abstract QuotaCounts computeQuotaUsage(BlockStoragePolicySuite bsps, byte blockStoragePolicyId, boolean useCache, int lastSnapshotId)
Quota.NAMESPACE and Quota.STORAGESPACE usages.
With the existence of INodeReference, the same inode and its
subtree may be referred by multiple INodeReference.WithName nodes and a
INodeReference.DstReference node. To avoid circles while quota usage computation,
we have the following rules:
1. For aINodeReference.DstReferencenode, since the node must be in the current tree (or has been deleted as the end point of a series of rename operations), we compute the quota usage of the referred node (and its subtree) in the regular manner, i.e., including every inode in the current tree and in snapshot copies, as well as the size of diff list. 2. For aINodeReference.WithNamenode, since the node must be in a snapshot, we only count the quota usage for those nodes that still existed at the creation time of the snapshot associated with theINodeReference.WithNamenode. We do not count in the size of the diff list.
bsps - Block storage policy suite to calculate intended storage type usageblockStoragePolicyId - block storage policy id of the current INodeuseCache - Whether to use cached quota usage. Note that
INodeReference.WithName node never uses cache for its subtree.lastSnapshotId - Snapshot.CURRENT_STATE_ID indicates the
computation is in the current tree. Otherwise the id
indicates the computation range for a
INodeReference.WithName node.public final QuotaCounts computeQuotaUsage(BlockStoragePolicySuite bsps, boolean useCache)
public final java.lang.String getLocalName()
public final byte[] getKey()
getKey in interface Diff.Element<byte[]>public abstract void setLocalName(byte[] name)
public java.lang.String getFullPathName()
public boolean isDeleted()
public byte[][] getPathComponents()
public java.lang.String toString()
toString in class java.lang.Object@VisibleForTesting public final java.lang.String getObjectString()
@VisibleForTesting public final java.lang.String getParentString()
@VisibleForTesting public java.lang.String getFullPathAndObjectString()
@VisibleForTesting public java.lang.String toDetailString()
public final INodeDirectory getParent()
public INodeReference getParentReference()
public boolean isLastReference()
public final void setParent(INodeDirectory parent)
public final void setParentReference(INodeReference parent)
public void clear()
public final long getModificationTime()
getModificationTime in interface INodeAttributespublic abstract INode updateModificationTime(long mtime, int latestSnapshotId)
public abstract void setModificationTime(long modificationTime)
public final INode setModificationTime(long modificationTime, int latestSnapshotId)
public final long getAccessTime()
getAccessTime in interface INodeAttributespublic abstract void setAccessTime(long accessTime)
public final INode setAccessTime(long accessTime, int latestSnapshotId, boolean skipCaptureAccessTimeOnlyChangeInSnapshot)
public abstract byte getStoragePolicyID()
public abstract byte getLocalStoragePolicyID()
HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED if no policy has
been specified.public byte getStoragePolicyIDForQuota(byte parentStoragePolicyId)
parentStoragePolicyId - the storage policy ID of the parent directoryINodeSymlink we return HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED
instead of throwing Exception@VisibleForTesting public static byte[][] getPathComponents(java.lang.String path)
path into components.public static java.lang.String[] getPathNames(java.lang.String path)
path into an array of path components.java.lang.AssertionError - if the given path is invalid.public final int compareTo(byte[] bytes)
compareTo in interface java.lang.Comparable<byte[]>public final boolean equals(java.lang.Object that)
equals in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Object@VisibleForTesting public final java.lang.StringBuilder dumpParentINodes()
@VisibleForTesting public final java.lang.StringBuffer dumpTreeRecursively()
@VisibleForTesting public final void dumpTreeRecursively(java.io.PrintStream out)
@VisibleForTesting
public void dumpTreeRecursively(java.io.PrintWriter out,
java.lang.StringBuilder prefix,
int snapshotId)
prefix - The prefix string that each line should print.public void dumpINode(java.io.PrintWriter out,
java.lang.StringBuilder prefix,
int snapshotId)
public void accept(NamespaceVisitor visitor, int snapshot)
INode.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.