Пример #1
0
 public virtual INode GetChild(INodeDirectory currentINode, byte[] name, int snapshotId
                               )
 {
     DirectoryWithSnapshotFeature.DirectoryDiff diff = diffs.GetDiffById(snapshotId);
     return(diff != null?diff.GetChild(name, true, currentINode) : currentINode.GetChild
                    (name, Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.CurrentStateId));
 }
Пример #2
0
 /// <summary>Used to record the modification of a symlink node</summary>
 public virtual INode SaveChild2Snapshot(INodeDirectory currentINode, INode child,
                                         int latestSnapshotId, INode snapshotCopy)
 {
     Preconditions.CheckArgument(!child.IsDirectory(), "child is a directory, child=%s"
                                 , child);
     Preconditions.CheckArgument(latestSnapshotId != Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot
                                 .CurrentStateId);
     DirectoryWithSnapshotFeature.DirectoryDiff diff = diffs.CheckAndAddLatestSnapshotDiff
                                                           (latestSnapshotId, currentINode);
     if (diff.GetChild(child.GetLocalNameBytes(), false, currentINode) != null)
     {
         // it was already saved in the latest snapshot earlier.
         return(child);
     }
     diff.diff.Modify(snapshotCopy, child);
     return(child);
 }