DirectoryWithSnapshotFeature (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.namenode.snapshot, class: DirectoryWithSnapshotFeature

Package org.apache.hadoop.hdfs.server.namenode.snapshot

# 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.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `DirectoryWithSnapshotFeature.DirectoryDiff`
  The difference of an `INodeDirectory` between two snapshots.
  `static class`
  `DirectoryWithSnapshotFeature.DirectoryDiffList`
  A list of directory diffs.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DirectoryWithSnapshotFeature(DirectoryWithSnapshotFeature.DirectoryDiffList diffs)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `addChild(INodeDirectory parent, INode inode, boolean setModTime, int latestSnapshotId)`
  Add an inode into parent's children list.
  `void`
  `cleanDirectory(INode.ReclaimContext reclaimContext, INodeDirectory currentINode, int snapshot, int prior)`
  `void`
  `clear(INode.ReclaimContext reclaimContext, INodeDirectory currentINode)`
  `void`
  `computeContentSummary4Snapshot(BlockStoragePolicySuite bsps, ContentCounts counts)`
  `QuotaCounts`
  `computeQuotaUsage4CurrentDirectory(BlockStoragePolicySuite bsps, byte storagePolicyId)`
  `static void`
  `destroyDstSubtree(INode.ReclaimContext reclaimContext, INode inode, int snapshot, int prior)`
  Destroy a subtree under a DstReference node.
  `INode`
  `getChild(INodeDirectory currentINode, byte[] name, int snapshotId)`
  `ReadOnlyList<INode>`
  `getChildrenList(INodeDirectory currentINode, int snapshotId)`
  `DirectoryWithSnapshotFeature.DirectoryDiffList`
  `getDiffs()`
  `int`
  `getLastSnapshotId()`
  `void`
  `getSnapshotDirectory(List<INodeDirectory> snapshotDir)`
  Get all the directories that are stored in some snapshot but not in the current children list.
  `boolean`
  `removeChild(INodeDirectory parent, INode child, int latestSnapshotId)`
  Remove an inode from parent's children list.
  `INode`
  `saveChild2Snapshot(INodeDirectory currentINode, INode child, int latestSnapshotId, INode snapshotCopy)`
  Used to record the modification of a symlink node
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### DirectoryWithSnapshotFeature

    public DirectoryWithSnapshotFeature(DirectoryWithSnapshotFeature.DirectoryDiffList diffs)

- ## 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

    public DirectoryWithSnapshotFeature.DirectoryDiffList 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`