Ejemplo n.º 1
0
        /// <summary>Add an inode into parent's children list.</summary>
        /// <remarks>
        /// 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".
        /// </remarks>
        /// <exception cref="Org.Apache.Hadoop.Hdfs.Protocol.QuotaExceededException"/>
        public virtual bool AddChild(INodeDirectory parent, INode inode, bool setModTime,
                                     int latestSnapshotId)
        {
            DirectoryWithSnapshotFeature.ChildrenDiff diff = diffs.CheckAndAddLatestSnapshotDiff
                                                                 (latestSnapshotId, parent).diff;
            int  undoInfo = diff.Create(inode);
            bool added    = parent.AddChild(inode, setModTime, Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot
                                            .CurrentStateId);

            if (!added)
            {
                diff.UndoCreate(inode, undoInfo);
            }
            return(added);
        }