Пример #1
0
        /// <summary>Call cleanSubtree(..) recursively down the subtree.</summary>
        public virtual QuotaCounts CleanSubtreeRecursively(BlockStoragePolicySuite bsps,
                                                           int snapshot, int prior, INode.BlocksMapUpdateInfo collectedBlocks, IList <INode>
                                                           removedINodes, IDictionary <INode, INode> excludedNodes)
        {
            QuotaCounts counts = new QuotaCounts.Builder().Build();
            // in case of deletion snapshot, since this call happens after we modify
            // the diff list, the snapshot to be deleted has been combined or renamed
            // to its latest previous snapshot. (besides, we also need to consider nodes
            // created after prior but before snapshot. this will be done in
            // DirectoryWithSnapshotFeature)
            int s = snapshot != Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.CurrentStateId &&
                    prior != Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.NoSnapshotId
                                 ? prior : snapshot;

            foreach (INode child in GetChildrenList(s))
            {
                if (snapshot != Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.CurrentStateId &&
                    excludedNodes != null && excludedNodes.Contains(child))
                {
                    continue;
                }
                else
                {
                    QuotaCounts childCounts = child.CleanSubtree(bsps, snapshot, prior, collectedBlocks
                                                                 , removedINodes);
                    counts.Add(childCounts);
                }
            }
            return(counts);
        }