Class FileWithSnapshotFeature

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.snapshot.FileWithSnapshotFeature
All Implemented Interfaces:
INode.Feature

@Private public class FileWithSnapshotFeature extends Object implements INode.Feature
Feature for file with snapshot-related information.
  • Constructor Details

    • FileWithSnapshotFeature

      public FileWithSnapshotFeature(FileDiffList diffs)
  • 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 set isCurrentFileDeleted to true for 2).
    • getDiffs

      public FileDiffList getDiffs()
    • getMaxBlockRepInDiffs

      public short getMaxBlockRepInDiffs(FileDiff excluded)
      Returns:
      the max replication factor in diffs
    • getDetailedString

      public String 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

      public void collectBlocksAndClear(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.
    • toString

      public String toString()
      Overrides:
      toString in class Object