Esempio n. 1
0
        public virtual DirectoryWithSnapshotFeature AddSnapshotFeature(DirectoryWithSnapshotFeature.DirectoryDiffList
                                                                       diffs)
        {
            Preconditions.CheckState(!IsWithSnapshot(), "Directory is already with snapshot");
            DirectoryWithSnapshotFeature sf = new DirectoryWithSnapshotFeature(diffs);

            AddFeature(sf);
            return(sf);
        }
Esempio n. 2
0
        /// <summary>
        /// Search for the given INode in the children list and the deleted lists of
        /// snapshots.
        /// </summary>
        /// <returns>
        ///
        /// <see cref="Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.CurrentStateId
        ///     "/>
        /// if the inode is in the children
        /// list;
        /// <see cref="Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.NoSnapshotId"
        ///     />
        /// if the inode is neither in the
        /// children list nor in any snapshot; otherwise the snapshot id of the
        /// corresponding snapshot diff list.
        /// </returns>
        public virtual int SearchChild(INode inode)
        {
            INode child = GetChild(inode.GetLocalNameBytes(), Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot
                                   .CurrentStateId);

            if (child != inode)
            {
                // inode is not in parent's children list, thus inode must be in
                // snapshot. identify the snapshot id and later add it into the path
                DirectoryWithSnapshotFeature.DirectoryDiffList diffs = GetDiffs();
                if (diffs == null)
                {
                    return(Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.NoSnapshotId);
                }
                return(diffs.FindSnapshotDeleted(inode));
            }
            else
            {
                return(Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.CurrentStateId);
            }
        }