Class FileWithSnapshotFeature
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.snapshot.FileWithSnapshotFeature
- All Implemented Interfaces:
INode.Feature
Feature for file with snapshot-related information.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanFile(INode.ReclaimContext reclaimContext, INodeFile file, int snapshotId, int priorSnapshotId, byte storagePolicyId) voidvoidcollectBlocksAndClear(INode.ReclaimContext reclaimContext, INodeFile file) If some blocks at the end of the block list no longer belongs to any inode, collect them and update the block list.voidWe need to distinguish two scenarios: 1) the file is still in the current file directory, it has been modified before while it is included in some snapshot 2) the file is not in the current file directory (deleted), but it is in some snapshot, thus we still keep this inode For both scenarios the file has snapshot feature.getDiffs()shortgetMaxBlockRepInDiffs(FileDiff excluded) booleantoString()voidupdateQuotaAndCollectBlocks(INode.ReclaimContext reclaimContext, INodeFile file, FileDiff removed)
-
Constructor Details
-
FileWithSnapshotFeature
-
-
Method Details
-
isCurrentFileDeleted
public boolean isCurrentFileDeleted() -
deleteCurrentFile
public void deleteCurrentFile()We need to distinguish two scenarios: 1) the file is still in the current file directory, it has been modified before while it is included in some snapshot 2) the file is not in the current file directory (deleted), but it is in some snapshot, thus we still keep this inode For both scenarios the file has snapshot feature. We setisCurrentFileDeletedto true for 2). -
getDiffs
-
getMaxBlockRepInDiffs
- Returns:
- the max replication factor in diffs
-
getDetailedString
-
cleanFile
public void cleanFile(INode.ReclaimContext reclaimContext, INodeFile file, int snapshotId, int priorSnapshotId, byte storagePolicyId) -
clearDiffs
public void clearDiffs() -
updateQuotaAndCollectBlocks
public void updateQuotaAndCollectBlocks(INode.ReclaimContext reclaimContext, INodeFile file, FileDiff removed) -
collectBlocksAndClear
If some blocks at the end of the block list no longer belongs to any inode, collect them and update the block list. -
toString
-