当前位置: 首页>>代码示例>>Java>>正文


Java FSImageSerialization.readString方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.FSImageSerialization.readString方法的典型用法代码示例。如果您正苦于以下问题:Java FSImageSerialization.readString方法的具体用法?Java FSImageSerialization.readString怎么用?Java FSImageSerialization.readString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.server.namenode.FSImageSerialization的用法示例。


在下文中一共展示了FSImageSerialization.readString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readINodePath

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
private String readINodePath(DataInputStream in, String parentName)
    throws IOException {
  String pathName = FSImageSerialization.readString(in);
  if (parentName != null) {  // local name
    pathName = "/" + pathName;
    if (!"/".equals(parentName)) { // children of non-root directory
      pathName = parentName + pathName;
    }
  }
  return pathName;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:ImageLoaderCurrent.java

示例2: processDirectory

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
private int processDirectory(DataInputStream in, ImageVisitor v,
   boolean skipBlocks) throws IOException {
  String parentName = FSImageSerialization.readString(in);
  int numChildren = in.readInt();
  for (int i=0; i<numChildren; i++) {
    processINode(in, v, skipBlocks, parentName);
  }
  return numChildren;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:10,代码来源:ImageLoaderCurrent.java

示例3: processINode

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
/**
  * Process an INode
  * 
  * @param in image stream
  * @param v visitor
  * @param skipBlocks skip blocks or not
  * @param parentName the name of its parent node
  * @throws IOException
  */
private void processINode(DataInputStream in, ImageVisitor v,
    boolean skipBlocks, String parentName) throws IOException {
  v.visitEnclosingElement(ImageElement.INODE);
  String pathName = FSImageSerialization.readString(in);
  if (parentName != null) {  // local name
    pathName = "/" + pathName;
    if (!"/".equals(parentName)) { // children of non-root directory
      pathName = parentName + pathName;
    }
  }

  v.visit(ImageElement.INODE_PATH, pathName);
  v.visit(ImageElement.REPLICATION, in.readShort());
  v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));
  if(LayoutVersion.supports(Feature.FILE_ACCESS_TIME, imageVersion))
    v.visit(ImageElement.ACCESS_TIME, formatDate(in.readLong()));
  v.visit(ImageElement.BLOCK_SIZE, in.readLong());
  int numBlocks = in.readInt();

  processBlocks(in, v, numBlocks, skipBlocks);

  // File or directory
  if (numBlocks > 0 || numBlocks == -1) {
    v.visit(ImageElement.NS_QUOTA, numBlocks == -1 ? in.readLong() : -1);
    if (LayoutVersion.supports(Feature.DISKSPACE_QUOTA, imageVersion))
      v.visit(ImageElement.DS_QUOTA, numBlocks == -1 ? in.readLong() : -1);
  }
  if (numBlocks == -2) {
    v.visit(ImageElement.SYMLINK, Text.readString(in));
  }

  processPermission(in, v);
  v.leaveEnclosingElement(); // INode
}
 
开发者ID:iVCE,项目名称:RDFS,代码行数:44,代码来源:ImageLoaderCurrent.java

示例4: processINodesUC

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
/**
 * Process the INodes under construction section of the fsimage.
 *
 * @param in DataInputStream to process
 * @param v Visitor to walk over inodes
 * @param skipBlocks Walk over each block?
 */
private void processINodesUC(DataInputStream in, ImageVisitor v,
    boolean skipBlocks) throws IOException {
  int numINUC = in.readInt();

  v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION,
                         ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC);

  for(int i = 0; i < numINUC; i++) {
    v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION);
    byte [] name = FSImageSerialization.readBytes(in);
    String n = new String(name, "UTF8");
    v.visit(ImageElement.INODE_PATH, n);
    
    if (NameNodeLayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) {
      long inodeId = in.readLong();
      v.visit(ImageElement.INODE_ID, inodeId);
    }
    
    v.visit(ImageElement.REPLICATION, in.readShort());
    v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));

    v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong());
    int numBlocks = in.readInt();
    processBlocks(in, v, numBlocks, skipBlocks);

    processPermission(in, v);
    v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in));
    v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in));

    // Skip over the datanode descriptors, which are still stored in the
    // file but are not used by the datanode or loaded into memory
    int numLocs = in.readInt();
    for(int j = 0; j < numLocs; j++) {
      in.readShort();
      in.readLong();
      in.readLong();
      in.readLong();
      in.readInt();
      FSImageSerialization.readString(in);
      FSImageSerialization.readString(in);
      WritableUtils.readEnum(in, AdminStates.class);
    }

    v.leaveEnclosingElement(); // INodeUnderConstruction
  }

  v.leaveEnclosingElement(); // INodesUnderConstruction
}
 
开发者ID:naver,项目名称:hadoop,代码行数:56,代码来源:ImageLoaderCurrent.java

示例5: processDirectory

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
private int processDirectory(DataInputStream in, ImageVisitor v,
   boolean skipBlocks) throws IOException {
  String parentName = FSImageSerialization.readString(in);
  return processChildren(in, v, skipBlocks, parentName);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:ImageLoaderCurrent.java

示例6: processDirectoryDiff

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
private void processDirectoryDiff(DataInputStream in, ImageVisitor v,
    String currentINodeName) throws IOException {
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF);
  int snapshotId = in.readInt();
  v.visit(ImageElement.SNAPSHOT_DIFF_SNAPSHOTID, snapshotId);
  v.visit(ImageElement.SNAPSHOT_DIR_DIFF_CHILDREN_SIZE, in.readInt());
  
  // process snapshotINode
  boolean useRoot = in.readBoolean();
  if (!useRoot) {
    if (in.readBoolean()) {
      v.visitEnclosingElement(ImageElement.SNAPSHOT_INODE_DIRECTORY_ATTRIBUTES);
      if (NameNodeLayoutVersion.supports(Feature.OPTIMIZE_SNAPSHOT_INODES, imageVersion)) {
        processINodeDirectoryAttributes(in, v, currentINodeName);
      } else {
        processINode(in, v, true, currentINodeName, true);
      }
      v.leaveEnclosingElement();
    }
  }
  
  // process createdList
  int createdSize = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_CREATEDLIST,
      ImageElement.SNAPSHOT_DIR_DIFF_CREATEDLIST_SIZE, createdSize);
  for (int i = 0; i < createdSize; i++) {
    String createdNode = FSImageSerialization.readString(in);
    v.visit(ImageElement.SNAPSHOT_DIR_DIFF_CREATED_INODE, createdNode);
  }
  v.leaveEnclosingElement();
  
  // process deletedList
  int deletedSize = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_DELETEDLIST,
      ImageElement.SNAPSHOT_DIR_DIFF_DELETEDLIST_SIZE, deletedSize);
  for (int i = 0; i < deletedSize; i++) {
    v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_DELETED_INODE);
    processINode(in, v, false, currentINodeName, true);
    v.leaveEnclosingElement();
  }
  v.leaveEnclosingElement();
  v.leaveEnclosingElement();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:44,代码来源:ImageLoaderCurrent.java

示例7: processINodesUC

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
/**
 * Process the INodes under construction section of the fsimage.
 *
 * @param in DataInputStream to process
 * @param v Visitor to walk over inodes
 * @param skipBlocks Walk over each block?
 */
private void processINodesUC(DataInputStream in, ImageVisitor v,
    boolean skipBlocks) throws IOException {
  int numINUC = in.readInt();

  v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION,
                         ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC);

  for(int i = 0; i < numINUC; i++) {
    checkInterruption();
    v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION);
    
    byte [] name = FSImageSerialization.readBytes(in);
    String n = new String(name, "UTF8");
    v.visit(ImageElement.INODE_PATH, n);
    
    if (LayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) {
      v.visit(ImageElement.INODE_ID, in.readLong());
    }
    
    v.visit(ImageElement.REPLICATION, in.readShort());
    v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));

    v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong());
    int numBlocks = in.readInt();
    processBlocks(in, v, numBlocks, skipBlocks);

    processPermission(in, v);
    v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in));
    v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in));

    // Skip over the datanode descriptors, which are still stored in the
    // file but are not used by the datanode or loaded into memory
    int numLocs = in.readInt();
    for(int j = 0; j < numLocs; j++) {
      in.readShort();
      in.readLong();
      in.readLong();
      in.readLong();
      in.readInt();
      FSImageSerialization.readString(in);
      FSImageSerialization.readString(in);
      WritableUtils.readEnum(in, AdminStates.class);
    }

    v.leaveEnclosingElement(); // INodeUnderConstruction
  }

  v.leaveEnclosingElement(); // INodesUnderConstruction
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:57,代码来源:ImageLoaderCurrent.java

示例8: processINode

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
/**
  * Process an INode
  * 
  * @param in image stream
  * @param v visitor
  * @param skipBlocks skip blocks or not
  * @param parentName the name of its parent node
  * @throws IOException
  */
private void processINode(DataInputStream in, ImageVisitor v,
    boolean skipBlocks, String parentName) throws IOException {
  checkInterruption();
  v.visitEnclosingElement(ImageElement.INODE);

  String pathName = FSImageSerialization.readString(in);
  if (parentName != null) {  // local name
    pathName = "/" + pathName;
    if (!"/".equals(parentName)) { // children of non-root directory
      pathName = parentName + pathName;
    }
  }

  v.visit(ImageElement.INODE_PATH, pathName);
  
  
  if (LayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) {
    v.visit(ImageElement.INODE_ID, in.readLong());
  }
  
  if (LayoutVersion.supports(Feature.HARDLINK, imageVersion)) {
    byte inodeType = in.readByte();
    if (inodeType == INode.INodeType.HARDLINKED_INODE.type) {
      v.visit(ImageElement.INODE_TYPE, INode.INodeType.HARDLINKED_INODE.toString());
      long hardlinkID =  WritableUtils.readVLong(in);
      v.visit(ImageElement.INODE_HARDLINK_ID, hardlinkID);
    } else if (inodeType == INode.INodeType.RAIDED_INODE.type) {
      v.visit(ImageElement.INODE_TYPE, INode.INodeType.RAIDED_INODE.toString());
      String codecId = WritableUtils.readString(in);
      v.visit(ImageElement.RAID_CODEC_ID, codecId);
    } else {
      v.visit(ImageElement.INODE_TYPE, INode.INodeType.REGULAR_INODE.toString());
    }
  }
  
  v.visit(ImageElement.REPLICATION, in.readShort());
  v.visit(ImageElement.MODIFICATION_TIME, in.readLong());
  if(LayoutVersion.supports(Feature.FILE_ACCESS_TIME, imageVersion))
    v.visit(ImageElement.ACCESS_TIME, in.readLong());
  v.visit(ImageElement.BLOCK_SIZE, in.readLong());
  int numBlocks = in.readInt();

  processBlocks(in, v, numBlocks, skipBlocks);

  // File or directory
  if (numBlocks > 0 || numBlocks == -1) {
    v.visit(ImageElement.NS_QUOTA, numBlocks == -1 ? in.readLong() : -1);
    if (LayoutVersion.supports(Feature.DISKSPACE_QUOTA, imageVersion))
      v.visit(ImageElement.DS_QUOTA, numBlocks == -1 ? in.readLong() : -1);
  }
  if (numBlocks == -2) {
    v.visit(ImageElement.SYMLINK, Text.readString(in));
  }

  processPermission(in, v);
  v.leaveEnclosingElement(); // INode
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:67,代码来源:ImageLoaderCurrent.java

示例9: processINodesUC

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
/**
 * Process the INodes under construction section of the fsimage.
 *
 * @param in DataInputStream to process
 * @param v Visitor to walk over inodes
 * @param skipBlocks Walk over each block?
 */
private void processINodesUC(DataInputStream in, ImageVisitor v,
    boolean skipBlocks) throws IOException {
  int numINUC = in.readInt();

  v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION,
                         ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC);

  for(int i = 0; i < numINUC; i++) {
    v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION);
    byte [] name = FSImageSerialization.readBytes(in);
    String n = new String(name, "UTF8");
    v.visit(ImageElement.INODE_PATH, n);
    
    if (LayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) {
      long inodeId = in.readLong();
      v.visit(ImageElement.INODE_ID, inodeId);
    }
    
    v.visit(ImageElement.REPLICATION, in.readShort());
    v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));

    v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong());
    int numBlocks = in.readInt();
    processBlocks(in, v, numBlocks, skipBlocks);

    processPermission(in, v);
    v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in));
    v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in));

    // Skip over the datanode descriptors, which are still stored in the
    // file but are not used by the datanode or loaded into memory
    int numLocs = in.readInt();
    for(int j = 0; j < numLocs; j++) {
      in.readShort();
      in.readLong();
      in.readLong();
      in.readLong();
      in.readInt();
      FSImageSerialization.readString(in);
      FSImageSerialization.readString(in);
      WritableUtils.readEnum(in, AdminStates.class);
    }

    v.leaveEnclosingElement(); // INodeUnderConstruction
  }

  v.leaveEnclosingElement(); // INodesUnderConstruction
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:56,代码来源:ImageLoaderCurrent.java

示例10: processDirectoryDiff

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
private void processDirectoryDiff(DataInputStream in, ImageVisitor v,
    String currentINodeName) throws IOException {
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF);
  int snapshotId = in.readInt();
  v.visit(ImageElement.SNAPSHOT_DIFF_SNAPSHOTID, snapshotId);
  v.visit(ImageElement.SNAPSHOT_DIR_DIFF_CHILDREN_SIZE, in.readInt());
  
  // process snapshotINode
  boolean useRoot = in.readBoolean();
  if (!useRoot) {
    if (in.readBoolean()) {
      v.visitEnclosingElement(ImageElement.SNAPSHOT_INODE_DIRECTORY_ATTRIBUTES);
      if (LayoutVersion.supports(Feature.OPTIMIZE_SNAPSHOT_INODES, imageVersion)) {
        processINodeDirectoryAttributes(in, v, currentINodeName);
      } else {
        processINode(in, v, true, currentINodeName, true);
      }
      v.leaveEnclosingElement();
    }
  }
  
  // process createdList
  int createdSize = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_CREATEDLIST,
      ImageElement.SNAPSHOT_DIR_DIFF_CREATEDLIST_SIZE, createdSize);
  for (int i = 0; i < createdSize; i++) {
    String createdNode = FSImageSerialization.readString(in);
    v.visit(ImageElement.SNAPSHOT_DIR_DIFF_CREATED_INODE, createdNode);
  }
  v.leaveEnclosingElement();
  
  // process deletedList
  int deletedSize = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_DELETEDLIST,
      ImageElement.SNAPSHOT_DIR_DIFF_DELETEDLIST_SIZE, deletedSize);
  for (int i = 0; i < deletedSize; i++) {
    v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_DELETED_INODE);
    processINode(in, v, false, currentINodeName, true);
    v.leaveEnclosingElement();
  }
  v.leaveEnclosingElement();
  v.leaveEnclosingElement();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:44,代码来源:ImageLoaderCurrent.java

示例11: processINodesUC

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
/**
 * Process the INodes under construction section of the fsimage.
 *
 * @param in DataInputStream to process
 * @param v Visitor to walk over inodes
 * @param skipBlocks Walk over each block?
 */
private void processINodesUC(DataInputStream in, ImageVisitor v,
    boolean skipBlocks) throws IOException {
  int numINUC = in.readInt();

  v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION,
                         ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC);

  for(int i = 0; i < numINUC; i++) {
    v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION);
    byte [] name = FSImageSerialization.readBytes(in);
    String n = new String(name, "UTF8");
    v.visit(ImageElement.INODE_PATH, n);
    
    if (NameNodeLayoutVersion.supports(
        LayoutVersion.Feature.ADD_INODE_ID, imageVersion)) {
      long inodeId = in.readLong();
      v.visit(ImageElement.INODE_ID, inodeId);
    }
    
    v.visit(ImageElement.REPLICATION, in.readShort());
    v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));

    v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong());
    int numBlocks = in.readInt();
    processBlocks(in, v, numBlocks, skipBlocks);

    processPermission(in, v);
    v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in));
    v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in));

    // Skip over the datanode descriptors, which are still stored in the
    // file but are not used by the datanode or loaded into memory
    int numLocs = in.readInt();
    for(int j = 0; j < numLocs; j++) {
      in.readShort();
      in.readLong();
      in.readLong();
      in.readLong();
      in.readInt();
      FSImageSerialization.readString(in);
      FSImageSerialization.readString(in);
      WritableUtils.readEnum(in, AdminStates.class);
    }

    v.leaveEnclosingElement(); // INodeUnderConstruction
  }

  v.leaveEnclosingElement(); // INodesUnderConstruction
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:57,代码来源:ImageLoaderCurrent.java

示例12: processDirectoryDiff

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
private void processDirectoryDiff(DataInputStream in, ImageVisitor v,
    String currentINodeName) throws IOException {
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF);
  int snapshotId = in.readInt();
  v.visit(ImageElement.SNAPSHOT_DIFF_SNAPSHOTID, snapshotId);
  v.visit(ImageElement.SNAPSHOT_DIR_DIFF_CHILDREN_SIZE, in.readInt());
  
  // process snapshotINode
  boolean useRoot = in.readBoolean();
  if (!useRoot) {
    if (in.readBoolean()) {
      v.visitEnclosingElement(ImageElement.SNAPSHOT_INODE_DIRECTORY_ATTRIBUTES);
      if (NameNodeLayoutVersion.supports(
          LayoutVersion.Feature.OPTIMIZE_SNAPSHOT_INODES, imageVersion)) {
        processINodeDirectoryAttributes(in, v, currentINodeName);
      } else {
        processINode(in, v, true, currentINodeName, true);
      }
      v.leaveEnclosingElement();
    }
  }
  
  // process createdList
  int createdSize = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_CREATEDLIST,
      ImageElement.SNAPSHOT_DIR_DIFF_CREATEDLIST_SIZE, createdSize);
  for (int i = 0; i < createdSize; i++) {
    String createdNode = FSImageSerialization.readString(in);
    v.visit(ImageElement.SNAPSHOT_DIR_DIFF_CREATED_INODE, createdNode);
  }
  v.leaveEnclosingElement();
  
  // process deletedList
  int deletedSize = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_DELETEDLIST,
      ImageElement.SNAPSHOT_DIR_DIFF_DELETEDLIST_SIZE, deletedSize);
  for (int i = 0; i < deletedSize; i++) {
    v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_DELETED_INODE);
    processINode(in, v, false, currentINodeName, true);
    v.leaveEnclosingElement();
  }
  v.leaveEnclosingElement();
  v.leaveEnclosingElement();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:45,代码来源:ImageLoaderCurrent.java

示例13: processINodesUC

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入方法依赖的package包/类
/**
 * Process the INodes under construction section of the fsimage.
 *
 * @param in DataInputStream to process
 * @param v Visitor to walk over inodes
 * @param skipBlocks Walk over each block?
 */
private void processINodesUC(DataInputStream in, ImageVisitor v,
    boolean skipBlocks) throws IOException {
  int numINUC = in.readInt();

  v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION,
                         ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC);

  for(int i = 0; i < numINUC; i++) {
    v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION);
    byte [] name = FSImageSerialization.readBytes(in);
    String n = new String(name, "UTF8");
    v.visit(ImageElement.INODE_PATH, n);
    v.visit(ImageElement.REPLICATION, in.readShort());
    v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));

    v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong());
    int numBlocks = in.readInt();
    processBlocks(in, v, numBlocks, skipBlocks);

    processPermission(in, v);
    v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in));
    v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in));

    // Skip over the datanode descriptors, which are still stored in the
    // file but are not used by the datanode or loaded into memory
    int numLocs = in.readInt();
    for(int j = 0; j < numLocs; j++) {
      in.readShort();
      in.readLong();
      in.readLong();
      in.readLong();
      in.readInt();
      FSImageSerialization.readString(in);
      FSImageSerialization.readString(in);
      WritableUtils.readEnum(in, AdminStates.class);
    }

    v.leaveEnclosingElement(); // INodeUnderConstruction
  }

  v.leaveEnclosingElement(); // INodesUnderConstruction
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:50,代码来源:ImageLoaderCurrent.java


注:本文中的org.apache.hadoop.hdfs.server.namenode.FSImageSerialization.readString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。