Java 类org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeDirectorySection 实例源码

项目:hadoop    文件:FSImageFormatPBINode.java   
void loadINodeDirectorySection(InputStream in) throws IOException {
  final List<INodeReference> refList = parent.getLoaderContext()
      .getRefList();
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    INodeDirectory p = dir.getInode(e.getParent()).asDirectory();
    for (long id : e.getChildrenList()) {
      INode child = dir.getInode(id);
      addToParent(p, child);
    }
    for (int refId : e.getRefChildrenList()) {
      INodeReference ref = refList.get(refId);
      addToParent(p, ref);
    }
  }
}
项目:hadoop    文件:PBImageXmlWriter.java   
private void dumpINodeDirectorySection(InputStream in) throws IOException {
  out.print("<INodeDirectorySection>");
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    out.print("<directory>");
    o("parent", e.getParent());
    for (long id : e.getChildrenList()) {
      o("inode", id);
    }
    for (int refId : e.getRefChildrenList()) {
      o("inodereference-index", refId);
    }
    out.print("</directory>\n");
  }
  out.print("</INodeDirectorySection>\n");
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
void loadINodeDirectorySection(InputStream in) throws IOException {
  final List<INodeReference> refList = parent.getLoaderContext()
      .getRefList();
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    INodeDirectory p = dir.getInode(e.getParent()).asDirectory();
    for (long id : e.getChildrenList()) {
      INode child = dir.getInode(id);
      addToParent(p, child);
    }
    for (int refId : e.getRefChildrenList()) {
      INodeReference ref = refList.get(refId);
      addToParent(p, ref);
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:PBImageXmlWriter.java   
private void dumpINodeDirectorySection(InputStream in) throws IOException {
  out.print("<INodeDirectorySection>");
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    out.print("<directory>");
    o("parent", e.getParent());
    for (long id : e.getChildrenList()) {
      o("inode", id);
    }
    for (int refId : e.getRefChildrenList()) {
      o("inodereference-index", refId);
    }
    out.print("</directory>\n");
  }
  out.print("</INodeDirectorySection>\n");
}
项目:big-c    文件:FSImageFormatPBINode.java   
void loadINodeDirectorySection(InputStream in) throws IOException {
  final List<INodeReference> refList = parent.getLoaderContext()
      .getRefList();
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    INodeDirectory p = dir.getInode(e.getParent()).asDirectory();
    for (long id : e.getChildrenList()) {
      INode child = dir.getInode(id);
      addToParent(p, child);
    }
    for (int refId : e.getRefChildrenList()) {
      INodeReference ref = refList.get(refId);
      addToParent(p, ref);
    }
  }
}
项目:big-c    文件:PBImageXmlWriter.java   
private void dumpINodeDirectorySection(InputStream in) throws IOException {
  out.print("<INodeDirectorySection>");
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    out.print("<directory>");
    o("parent", e.getParent());
    for (long id : e.getChildrenList()) {
      o("inode", id);
    }
    for (int refId : e.getRefChildrenList()) {
      o("inodereference-index", refId);
    }
    out.print("</directory>\n");
  }
  out.print("</INodeDirectorySection>\n");
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
void loadINodeDirectorySection(InputStream in) throws IOException {
  final List<INodeReference> refList = parent.getLoaderContext()
      .getRefList();
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    INodeDirectory p = dir.getInode(e.getParent()).asDirectory();
    for (long id : e.getChildrenList()) {
      INode child = dir.getInode(id);
      addToParent(p, child);
    }
    for (int refId : e.getRefChildrenList()) {
      INodeReference ref = refList.get(refId);
      addToParent(p, ref);
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBImageXmlWriter.java   
private void dumpINodeDirectorySection(InputStream in) throws IOException {
  out.print("<INodeDirectorySection>");
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    out.print("<directory>");
    o("parent", e.getParent());
    for (long id : e.getChildrenList()) {
      o("inode", id);
    }
    for (int refId : e.getRefChildrenList()) {
      o("inodereference-index", refId);
    }
    out.print("</directory>\n");
  }
  out.print("</INodeDirectorySection>\n");
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
void loadINodeDirectorySection(InputStream in) throws IOException {
  final List<INodeReference> refList = parent.getLoaderContext()
      .getRefList();
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    INodeDirectory p = dir.getInode(e.getParent()).asDirectory();
    for (long id : e.getChildrenList()) {
      INode child = dir.getInode(id);
      addToParent(p, child);
    }
    for (int refId : e.getRefChildrenList()) {
      INodeReference ref = refList.get(refId);
      addToParent(p, ref);
    }
  }
}
项目:FlexMap    文件:PBImageXmlWriter.java   
private void dumpINodeDirectorySection(InputStream in) throws IOException {
  out.print("<INodeDirectorySection>");
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    out.print("<directory>");
    o("parent", e.getParent());
    for (long id : e.getChildrenList()) {
      o("inode", id);
    }
    for (int refId : e.getRefChildrenList()) {
      o("inodereference-index", refId);
    }
    out.print("</directory>\n");
  }
  out.print("</INodeDirectorySection>\n");
}
项目:hadoop-on-lustre2    文件:FSImageFormatPBINode.java   
void loadINodeDirectorySection(InputStream in) throws IOException {
  final List<INodeReference> refList = parent.getLoaderContext()
      .getRefList();
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    INodeDirectory p = dir.getInode(e.getParent()).asDirectory();
    for (long id : e.getChildrenList()) {
      INode child = dir.getInode(id);
      addToParent(p, child);
    }
    for (int refId : e.getRefChildrenList()) {
      INodeReference ref = refList.get(refId);
      addToParent(p, ref);
    }
  }
}
项目:hadoop-on-lustre2    文件:PBImageXmlWriter.java   
private void dumpINodeDirectorySection(InputStream in) throws IOException {
  out.print("<INodeDirectorySection>");
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    out.print("<directory>");
    o("parent", e.getParent());
    for (long id : e.getChildrenList()) {
      o("inode", id);
    }
    for (int refId : e.getRefChildrenList()) {
      o("inodereference-index", refId);
    }
    out.print("</directory>\n");
  }
  out.print("</INodeDirectorySection>\n");
}
项目:hadoop    文件:FSImageFormatPBINode.java   
void serializeINodeDirectorySection(OutputStream out) throws IOException {
  Iterator<INodeWithAdditionalFields> iter = fsn.getFSDirectory()
      .getINodeMap().getMapIterator();
  final ArrayList<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(
        Snapshot.CURRENT_STATE_ID);
    if (children.size() > 0) {
      INodeDirectorySection.DirEntry.Builder b = INodeDirectorySection.
          DirEntry.newBuilder().setParent(n.getId());
      for (INode inode : children) {
        if (!inode.isReference()) {
          b.addChildren(inode.getId());
        } else {
          refList.add(inode.asReference());
          b.addRefChildren(refList.size() - 1);
        }
      }
      INodeDirectorySection.DirEntry e = b.build();
      e.writeDelimitedTo(out);
    }

    ++i;
    if (i % FSImageFormatProtobuf.Saver.CHECK_CANCEL_INTERVAL == 0) {
      context.checkCancelled();
    }
  }
  parent.commitSection(summary,
      FSImageFormatProtobuf.SectionName.INODE_DIR);
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
void serializeINodeDirectorySection(OutputStream out) throws IOException {
  Iterator<INodeWithAdditionalFields> iter = fsn.getFSDirectory()
      .getINodeMap().getMapIterator();
  final ArrayList<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(
        Snapshot.CURRENT_STATE_ID);
    if (children.size() > 0) {
      INodeDirectorySection.DirEntry.Builder b = INodeDirectorySection.
          DirEntry.newBuilder().setParent(n.getId());
      for (INode inode : children) {
        if (!inode.isReference()) {
          b.addChildren(inode.getId());
        } else {
          refList.add(inode.asReference());
          b.addRefChildren(refList.size() - 1);
        }
      }
      INodeDirectorySection.DirEntry e = b.build();
      e.writeDelimitedTo(out);
    }

    ++i;
    if (i % FSImageFormatProtobuf.Saver.CHECK_CANCEL_INTERVAL == 0) {
      context.checkCancelled();
    }
  }
  parent.commitSection(summary,
      FSImageFormatProtobuf.SectionName.INODE_DIR);
}
项目:big-c    文件:FSImageFormatPBINode.java   
void serializeINodeDirectorySection(OutputStream out) throws IOException {
  Iterator<INodeWithAdditionalFields> iter = fsn.getFSDirectory()
      .getINodeMap().getMapIterator();
  final ArrayList<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(
        Snapshot.CURRENT_STATE_ID);
    if (children.size() > 0) {
      INodeDirectorySection.DirEntry.Builder b = INodeDirectorySection.
          DirEntry.newBuilder().setParent(n.getId());
      for (INode inode : children) {
        if (!inode.isReference()) {
          b.addChildren(inode.getId());
        } else {
          refList.add(inode.asReference());
          b.addRefChildren(refList.size() - 1);
        }
      }
      INodeDirectorySection.DirEntry e = b.build();
      e.writeDelimitedTo(out);
    }

    ++i;
    if (i % FSImageFormatProtobuf.Saver.CHECK_CANCEL_INTERVAL == 0) {
      context.checkCancelled();
    }
  }
  parent.commitSection(summary,
      FSImageFormatProtobuf.SectionName.INODE_DIR);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
void serializeINodeDirectorySection(OutputStream out) throws IOException {
  Iterator<INodeWithAdditionalFields> iter = fsn.getFSDirectory()
      .getINodeMap().getMapIterator();
  final ArrayList<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(
        Snapshot.CURRENT_STATE_ID);
    if (children.size() > 0) {
      INodeDirectorySection.DirEntry.Builder b = INodeDirectorySection.
          DirEntry.newBuilder().setParent(n.getId());
      for (INode inode : children) {
        if (!inode.isReference()) {
          b.addChildren(inode.getId());
        } else {
          refList.add(inode.asReference());
          b.addRefChildren(refList.size() - 1);
        }
      }
      INodeDirectorySection.DirEntry e = b.build();
      e.writeDelimitedTo(out);
    }

    ++i;
    if (i % FSImageFormatProtobuf.Saver.CHECK_CANCEL_INTERVAL == 0) {
      context.checkCancelled();
    }
  }
  parent.commitSection(summary,
      FSImageFormatProtobuf.SectionName.INODE_DIR);
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
void serializeINodeDirectorySection(OutputStream out) throws IOException {
  Iterator<INodeWithAdditionalFields> iter = fsn.getFSDirectory()
      .getINodeMap().getMapIterator();
  final ArrayList<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(
        Snapshot.CURRENT_STATE_ID);
    if (children.size() > 0) {
      INodeDirectorySection.DirEntry.Builder b = INodeDirectorySection.
          DirEntry.newBuilder().setParent(n.getId());
      for (INode inode : children) {
        if (!inode.isReference()) {
          b.addChildren(inode.getId());
        } else {
          refList.add(inode.asReference());
          b.addRefChildren(refList.size() - 1);
        }
      }
      INodeDirectorySection.DirEntry e = b.build();
      e.writeDelimitedTo(out);
    }

    ++i;
    if (i % FSImageFormatProtobuf.Saver.CHECK_CANCEL_INTERVAL == 0) {
      context.checkCancelled();
    }
  }
  parent.commitSection(summary,
      FSImageFormatProtobuf.SectionName.INODE_DIR);
}
项目:hadoop-on-lustre2    文件:FSImageFormatPBINode.java   
void serializeINodeDirectorySection(OutputStream out) throws IOException {
  Iterator<INodeWithAdditionalFields> iter = fsn.getFSDirectory()
      .getINodeMap().getMapIterator();
  final ArrayList<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(
        Snapshot.CURRENT_STATE_ID);
    if (children.size() > 0) {
      INodeDirectorySection.DirEntry.Builder b = INodeDirectorySection.
          DirEntry.newBuilder().setParent(n.getId());
      for (INode inode : children) {
        if (!inode.isReference()) {
          b.addChildren(inode.getId());
        } else {
          refList.add(inode.asReference());
          b.addRefChildren(refList.size() - 1);
        }
      }
      INodeDirectorySection.DirEntry e = b.build();
      e.writeDelimitedTo(out);
    }

    ++i;
    if (i % FSImageFormatProtobuf.Saver.CHECK_CANCEL_INTERVAL == 0) {
      context.checkCancelled();
    }
  }
  parent.commitSection(summary,
      FSImageFormatProtobuf.SectionName.INODE_DIR);
}
项目:hadoop-on-lustre2    文件:LsrPBImage.java   
private void loadINodeDirectorySection(InputStream in) throws IOException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Loading directory section");
  }
  while (true) {
    INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry
        .parseDelimitedFrom(in);
    // note that in is a LimitedInputStream
    if (e == null) {
      break;
    }
    long[] l = new long[e.getChildrenCount() + e.getRefChildrenCount()];
    for (int i = 0; i < e.getChildrenCount(); ++i) {
      l[i] = e.getChildren(i);
    }
    for (int i = e.getChildrenCount(); i < l.length; i++) {
      int refId = e.getRefChildren(i - e.getChildrenCount());
      l[i] = refList.get(refId).getReferredId();
    }
    dirmap.put(e.getParent(), l);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Loaded directory (parent " + e.getParent()
          + ") with " + e.getChildrenCount() + " children and "
          + e.getRefChildrenCount() + " reference children");
    }
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("Loaded " + dirmap.size() + " directories");
  }
}