Class DirectoryWithSnapshotFeature

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature
All Implemented Interfaces:
INode.Feature
Direct Known Subclasses:
DirectorySnapshottableFeature

@Private public class DirectoryWithSnapshotFeature extends Object implements INode.Feature
Feature used to store and process the snapshot diff information for a directory. In particular, it contains a directory diff list recording changes made to the directory and its children for each snapshot.
  • Constructor Details

  • Method Details

    • destroyDstSubtree

      public static void destroyDstSubtree(INode.ReclaimContext reclaimContext, INode inode, int snapshot, int prior)
      Destroy a subtree under a DstReference node.
    • getLastSnapshotId

      public int getLastSnapshotId()
      Returns:
      the last snapshot.
    • getDiffs

      Returns:
      the snapshot diff list.
    • getSnapshotDirectory

      public void getSnapshotDirectory(List<INodeDirectory> snapshotDir)
      Get all the directories that are stored in some snapshot but not in the current children list. These directories are equivalent to the directories stored in the deletes lists.
    • addChild

      public boolean addChild(INodeDirectory parent, INode inode, boolean setModTime, int latestSnapshotId)
      Add an inode into parent's children list. The caller of this method needs to make sure that parent is in the given snapshot "latest".
    • removeChild

      public boolean removeChild(INodeDirectory parent, INode child, int latestSnapshotId)
      Remove an inode from parent's children list. The caller of this method needs to make sure that parent is in the given snapshot "latest".
    • getChildrenList

      public ReadOnlyList<INode> getChildrenList(INodeDirectory currentINode, int snapshotId)
      Returns:
      If there is no corresponding directory diff for the given snapshot, this means that the current children list should be returned for the snapshot. Otherwise we calculate the children list for the snapshot and return it.
    • getChild

      public INode getChild(INodeDirectory currentINode, byte[] name, int snapshotId)
    • saveChild2Snapshot

      public INode saveChild2Snapshot(INodeDirectory currentINode, INode child, int latestSnapshotId, INode snapshotCopy)
      Used to record the modification of a symlink node
    • clear

      public void clear(INode.ReclaimContext reclaimContext, INodeDirectory currentINode)
    • computeQuotaUsage4CurrentDirectory

      public QuotaCounts computeQuotaUsage4CurrentDirectory(BlockStoragePolicySuite bsps, byte storagePolicyId)
    • computeContentSummary4Snapshot

      public void computeContentSummary4Snapshot(BlockStoragePolicySuite bsps, ContentCounts counts) throws org.apache.hadoop.security.AccessControlException
      Throws:
      org.apache.hadoop.security.AccessControlException
    • cleanDirectory

      public void cleanDirectory(INode.ReclaimContext reclaimContext, INodeDirectory currentINode, int snapshot, int prior)
    • toString

      public String toString()
      Overrides:
      toString in class Object