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


Java LayoutVersion.supports方法代码示例

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


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

示例1: processFileDiff

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
private void processFileDiff(DataInputStream in, ImageVisitor v,
    String currentINodeName) throws IOException {
  int snapshotId = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_FILE_DIFF,
      ImageElement.SNAPSHOT_DIFF_SNAPSHOTID, snapshotId);
  v.visit(ImageElement.SNAPSHOT_FILE_SIZE, in.readLong());
  if (in.readBoolean()) {
    v.visitEnclosingElement(ImageElement.SNAPSHOT_INODE_FILE_ATTRIBUTES);
    if (LayoutVersion.supports(Feature.OPTIMIZE_SNAPSHOT_INODES, imageVersion)) {
      processINodeFileAttributes(in, v, currentINodeName);
    } else {
      processINode(in, v, true, currentINodeName, true);
    }
    v.leaveEnclosingElement();
  }
  v.leaveEnclosingElement();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:18,代码来源:ImageLoaderCurrent.java

示例2: readFields

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
@Override
void readFields(DataInputStream in, int logVersion)
    throws IOException {
  if (!LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
    this.length = in.readInt();
    if (this.length != 2) {
      throw new IOException("Incorrect data format. " + "delete operation.");
    }
  }
  this.path = FSImageSerialization.readString(in);
  if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
    this.timestamp = FSImageSerialization.readLong(in);
  } else {
    this.timestamp = readLong(in);
  }
  // read RPC ids if necessary
  readRpcIds(in, logVersion);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:19,代码来源:FSEditLogOp.java

示例3: visit_OP_GET_DELEGATION_TOKEN

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
/**
 * Visit OP_GET_DELEGATION_TOKEN
 */
private void visit_OP_GET_DELEGATION_TOKEN() throws IOException {
  visitTxId();
  
  v.visitByte(EditsElement.T_VERSION);
  v.visitStringText(EditsElement.T_OWNER);
  v.visitStringText(EditsElement.T_RENEWER);
  v.visitStringText(EditsElement.T_REAL_USER);
  v.visitVLong(EditsElement.T_ISSUE_DATE);
  v.visitVLong(EditsElement.T_MAX_DATE);
  v.visitVInt(EditsElement.T_SEQUENCE_NUMBER);
  v.visitVInt(EditsElement.T_MASTER_KEY_ID);
  if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
    v.visitLong(EditsElement.T_EXPIRY_TIME);
  } else {
    v.visitStringUTF8(EditsElement.T_EXPIRY_TIME);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:21,代码来源:EditsLoaderCurrent.java

示例4: Reader

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
/**
 * Construct the reader
 * @param in The stream to read from.
 * @param logVersion The version of the data coming from the stream.
 */
@SuppressWarnings("deprecation")
public Reader(DataInputStream in, int logVersion) {
  this.logVersion = logVersion;
  if (LayoutVersion.supports(Feature.EDITS_CHESKUM, logVersion)) {
    this.checksum = FSEditLog.getChecksumForRead();
  } else {
    this.checksum = null;
  }

  if (this.checksum != null) {
    this.in = new DataInputStream(
        new CheckedInputStream(in, this.checksum));
  } else {
    this.in = in;
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:22,代码来源:FSEditLogOp.java

示例5: visit_OP_RENEW_DELEGATION_TOKEN

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
/**
 * Visit OP_RENEW_DELEGATION_TOKEN
 */
private void visit_OP_RENEW_DELEGATION_TOKEN()
    throws IOException {
    visitTxId();

    v.visitByte(EditsElement.T_VERSION);
    v.visitStringText(EditsElement.T_OWNER);
    v.visitStringText(EditsElement.T_RENEWER);
    v.visitStringText(EditsElement.T_REAL_USER);
    v.visitVLong(EditsElement.T_ISSUE_DATE);
    v.visitVLong(EditsElement.T_MAX_DATE);
    v.visitVInt(EditsElement.T_SEQUENCE_NUMBER);
    v.visitVInt(EditsElement.T_MASTER_KEY_ID);
    if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
      v.visitLong(EditsElement.T_EXPIRY_TIME);
    } else {
      v.visitStringUTF8(EditsElement.T_EXPIRY_TIME);
    }
  }
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:22,代码来源:EditsLoaderCurrent.java

示例6: visit_Blocks

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
private void visit_Blocks() throws IOException {
  IntToken numBlocksToken = v.visitInt(EditsElement.NUMBLOCKS);
  for (int i = 0; i < numBlocksToken.value; i++) {
    v.visitEnclosingElement(EditsElement.BLOCK);

    v.visitLong(EditsElement.BLOCK_ID);
    v.visitLong(EditsElement.BLOCK_NUM_BYTES);
    v.visitLong(EditsElement.BLOCK_GENERATION_STAMP);
    
    if (LayoutVersion.supports(Feature.BLOCK_CHECKSUM, editsVersion)) {
      v.visitInt(EditsElement.BLOCK_CHECKSUM);
    }

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

示例7: setClusterId

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
/** Validate and set clusterId from {@link Properties}*/
protected void setClusterId(Properties props, int layoutVersion,
    StorageDirectory sd) throws InconsistentFSStateException {
  // Set cluster ID in version that supports federation
  if (LayoutVersion.supports(getServiceLayoutFeatureMap(),
      Feature.FEDERATION, layoutVersion)) {
    String cid = getProperty(props, sd, "clusterID");
    if (!(clusterID.equals("") || cid.equals("") || clusterID.equals(cid))) {
      throw new InconsistentFSStateException(sd.getRoot(),
          "cluster Id is incompatible with others.");
    }
    clusterID = cid;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:StorageInfo.java

示例8: visit_OP_RENAME

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
/**
 * Visit OP_RENAME
 */
private void visit_OP_RENAME() throws IOException {
  visitTxId();
  if (!LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
    v.visitInt(EditsElement.LENGTH);
  }
  v.visitStringUTF8(    EditsElement.SOURCE);
  v.visitStringUTF8(    EditsElement.DESTINATION);
  if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
    v.visitLong(EditsElement.TIMESTAMP);
  } else {
    v.visitStringUTF8(EditsElement.TIMESTAMP);
  }
  v.visitBytesWritable( EditsElement.RENAME_OPTIONS);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:18,代码来源:EditsLoaderCurrent.java

示例9: linkAllBlocks

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
/**
 * Hardlink all finalized and RBW blocks in fromDir to toDir
 *
 * @param fromDir      The directory where the 'from' snapshot is stored
 * @param fromBbwDir   In HDFS 1.x, the directory where blocks
 *                     that are under construction are stored.
 * @param toDir        The current data directory
 *
 * @throws IOException If error occurs during hardlink
 */
private void linkAllBlocks(File fromDir, File fromBbwDir, File toDir)
    throws IOException {
  HardLink hardLink = new HardLink();
  // do the link
  int diskLayoutVersion = this.getLayoutVersion();
  if (LayoutVersion.supports(Feature.APPEND_RBW_DIR, diskLayoutVersion)) {
    // hardlink finalized blocks in tmpDir/finalized
    linkBlocks(new File(fromDir, STORAGE_DIR_FINALIZED), 
        new File(toDir, STORAGE_DIR_FINALIZED), diskLayoutVersion, hardLink);
    // hardlink rbw blocks in tmpDir/rbw
    linkBlocks(new File(fromDir, STORAGE_DIR_RBW), 
        new File(toDir, STORAGE_DIR_RBW), diskLayoutVersion, hardLink);
  } else { // pre-RBW version
    // hardlink finalized blocks in tmpDir
    linkBlocks(fromDir, new File(toDir, STORAGE_DIR_FINALIZED), 
        diskLayoutVersion, hardLink);      
    if (fromBbwDir.exists()) {
      /*
       * We need to put the 'blocksBeingWritten' from HDFS 1.x into the rbw
       * directory.  It's a little messy, because the blocksBeingWriten was
       * NOT underneath the 'current' directory in those releases.  See
       * HDFS-3731 for details.
       */
      linkBlocks(fromBbwDir,
          new File(toDir, STORAGE_DIR_RBW), diskLayoutVersion, hardLink);
    }
  } 
  LOG.info( hardLink.linkStats.report() );
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:40,代码来源:DataStorage.java

示例10: visit_OP_MKDIR

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
/**
 * Visit OP_MKDIR
 */
private void visit_OP_MKDIR() throws IOException {
  visitTxId();
  if (!LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
    v.visitInt(EditsElement.LENGTH);
  }
  
  v.visitStringUTF8( EditsElement.PATH);
  
  if (LayoutVersion.supports(Feature.ADD_INODE_ID, editsVersion)) {
    v.visitLong(EditsElement.INODE_ID);
  }
  
  if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
    v.visitLong(EditsElement.TIMESTAMP);
    v.visitLong(EditsElement.ATIME);
  } else {
    v.visitStringUTF8(EditsElement.TIMESTAMP);
    v.visitStringUTF8(EditsElement.ATIME);
  }
  // PERMISSION_STATUS
  v.visitEnclosingElement( EditsElement.PERMISSION_STATUS);

  v.visitStringText( EditsElement.USERNAME);
  v.visitStringText( EditsElement.GROUPNAME);
  v.visitShort(      EditsElement.FS_PERMISSIONS);

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

示例11: readFields

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
@Override
void readFields(DataInputStream in, int logVersion)
    throws IOException {
  this.path = FSImageSerialization.readString(in);
  if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
    this.replication = FSImageSerialization.readShort(in);
  } else {
    this.replication = readShort(in);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:11,代码来源:FSEditLogOp.java

示例12: readRpcIds

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
void readRpcIds(DataInputStream in, int logVersion)
    throws IOException {
  if (LayoutVersion.supports(Feature.EDITLOG_SUPPORT_RETRYCACHE,
      logVersion)) {
    this.rpcClientId = FSImageSerialization.readBytes(in);
    this.rpcCallId = FSImageSerialization.readInt(in);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:9,代码来源:FSEditLogOp.java

示例13: visit_OP_DELETE

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
/**
 * Visit OP_DELETE
 */
private void visit_OP_DELETE() throws IOException {
  visitTxId();
  if (!LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
    v.visitInt(EditsElement.LENGTH);
  }
  v.visitStringUTF8( EditsElement.PATH);
  if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
    v.visitLong(EditsElement.TIMESTAMP);
  } else {
    v.visitStringUTF8(EditsElement.TIMESTAMP);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:16,代码来源:EditsLoaderCurrent.java

示例14: supports

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
public static boolean supports(final LayoutFeature f, final int lv) {
  return LayoutVersion.supports(FEATURES, f, lv);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:NameNodeLayoutVersion.java

示例15: versionSupportsFederation

import org.apache.hadoop.hdfs.protocol.LayoutVersion; //导入方法依赖的package包/类
public boolean versionSupportsFederation(
    Map<Integer, SortedSet<LayoutFeature>> map) {
  return LayoutVersion.supports(map, LayoutVersion.Feature.FEDERATION,
      layoutVersion);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:StorageInfo.java


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