Exemplo n.º 1
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);
            }
Exemplo n.º 2
0
            /// <exception cref="System.IO.IOException"/>
            internal void SerializeINodeSection(OutputStream @out)
            {
                INodeMap inodesMap = fsn.dir.GetINodeMap();

                FsImageProto.INodeSection.Builder b = FsImageProto.INodeSection.NewBuilder().SetLastInodeId
                                                          (fsn.dir.GetLastInodeId()).SetNumInodes(inodesMap.Size());
                FsImageProto.INodeSection s = ((FsImageProto.INodeSection)b.Build());
                s.WriteDelimitedTo(@out);
                int i = 0;
                IEnumerator <INodeWithAdditionalFields> iter = inodesMap.GetMapIterator();

                while (iter.HasNext())
                {
                    INodeWithAdditionalFields n = iter.Next();
                    Save(@out, n);
                    ++i;
                    if (i % FSImageFormatProtobuf.Saver.CheckCancelInterval == 0)
                    {
                        context.CheckCancelled();
                    }
                }
                parent.CommitSection(summary, FSImageFormatProtobuf.SectionName.Inode);
            }
Exemplo n.º 3
0
 internal void CloneModificationTime(INodeWithAdditionalFields that)
 {
     this.modificationTime = that.modificationTime;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Clone the
 /// <see cref="Org.Apache.Hadoop.FS.Permission.PermissionStatus"/>
 /// .
 /// </summary>
 internal void ClonePermissionStatus(INodeWithAdditionalFields that)
 {
     this.permission = that.permission;
 }
Exemplo n.º 5
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)
 {
 }
Exemplo n.º 6
0
 /// <exception cref="System.IO.IOException"/>
 private void AddAcl(INodeWithAdditionalFields inode, params AclEntry[] acl)
 {
     AclStorage.UpdateINodeAcl(inode, Arrays.AsList(acl), Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot
                               .CurrentStateId);
 }