Пример #1
0
 /// <param name="other">Other node to be copied</param>
 internal INodeWithAdditionalFields(INodeWithAdditionalFields other)
     : this(other.GetParentReference() != null ? other.GetParentReference() : other.GetParent
                (), other.GetId(), other.GetLocalNameBytes(), other.permission, other.modificationTime
            , other.accessTime)
 {
 }
Пример #2
0
            /// <exception cref="System.IO.IOException"/>
            internal void SerializeINodeDirectorySection(OutputStream @out)
            {
                IEnumerator <INodeWithAdditionalFields> iter = fsn.GetFSDirectory().GetINodeMap().
                                                               GetMapIterator();
                AList <INodeReference> refList = parent.GetSaverContext().GetRefList();
                int i = 0;

                while (iter.HasNext())
                {
                    INodeWithAdditionalFields n = iter.Next();
                    if (!n.IsDirectory())
                    {
                        continue;
                    }
                    ReadOnlyList <INode> children = n.AsDirectory().GetChildrenList(Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot
                                                                                    .CurrentStateId);
                    if (children.Size() > 0)
                    {
                        FsImageProto.INodeDirectorySection.DirEntry.Builder b = FsImageProto.INodeDirectorySection.DirEntry
                                                                                .NewBuilder().SetParent(n.GetId());
                        foreach (INode inode in children)
                        {
                            if (!inode.IsReference())
                            {
                                b.AddChildren(inode.GetId());
                            }
                            else
                            {
                                refList.AddItem(inode.AsReference());
                                b.AddRefChildren(refList.Count - 1);
                            }
                        }
                        FsImageProto.INodeDirectorySection.DirEntry e = ((FsImageProto.INodeDirectorySection.DirEntry
                                                                          )b.Build());
                        e.WriteDelimitedTo(@out);
                    }
                    ++i;
                    if (i % FSImageFormatProtobuf.Saver.CheckCancelInterval == 0)
                    {
                        context.CheckCancelled();
                    }
                }
                parent.CommitSection(summary, FSImageFormatProtobuf.SectionName.InodeDir);
            }