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


Java HdfsFileStatus.getReplication方法代码示例

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


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

示例1: getChecksum4Compute

import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; //导入方法依赖的package包/类
/** 
 * @return the object for computing checksum.
 *         The type is NULL if checksum is not computed.
 */
private static DataChecksum getChecksum4Compute(DataChecksum checksum,
    HdfsFileStatus stat) {
  if (isLazyPersist(stat) && stat.getReplication() == 1) {
    // do not compute checksum for writing to single replica to memory
    return DataChecksum.newDataChecksum(Type.NULL,
        checksum.getBytesPerChecksum());
  }
  return checksum;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:DFSOutputStream.java

示例2: DFSOutputStream

import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; //导入方法依赖的package包/类
private DFSOutputStream(DFSClient dfsClient, String src, Progressable progress,
    HdfsFileStatus stat, DataChecksum checksum) throws IOException {
  super(getChecksum4Compute(checksum, stat));
  this.dfsClient = dfsClient;
  this.src = src;
  this.fileId = stat.getFileId();
  this.blockSize = stat.getBlockSize();
  this.blockReplication = stat.getReplication();
  this.fileEncryptionInfo = stat.getFileEncryptionInfo();
  this.progress = progress;
  this.cachingStrategy = new AtomicReference<CachingStrategy>(
      dfsClient.getDefaultWriteCachingStrategy());
  if ((progress != null) && DFSClient.LOG.isDebugEnabled()) {
    DFSClient.LOG.debug(
        "Set non-null progress callback on DFSOutputStream " + src);
  }
  
  this.bytesPerChecksum = checksum.getBytesPerChecksum();
  if (bytesPerChecksum <= 0) {
    throw new HadoopIllegalArgumentException(
        "Invalid value: bytesPerChecksum = " + bytesPerChecksum + " <= 0");
  }
  if (blockSize % bytesPerChecksum != 0) {
    throw new HadoopIllegalArgumentException("Invalid values: "
        + DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY + " (=" + bytesPerChecksum
        + ") must divide block size (=" + blockSize + ").");
  }
  this.checksum4WriteBlock = checksum;

  this.dfsclientSlowLogThresholdMs =
    dfsClient.getConf().dfsclientSlowIoWarningThresholdMs;
  this.byteArrayManager = dfsClient.getClientContext().getByteArrayManager();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:34,代码来源:DFSOutputStream.java

示例3: makeQualified

import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; //导入方法依赖的package包/类
private FileStatus makeQualified(HdfsFileStatus f, Path parent) {
  return new FileStatus(f.getLen(), f.isDir(), f.getReplication(),
      f.getBlockSize(), f.getModificationTime(), f.getAccessTime(),
      f.getPermission(), f.getOwner(), f.getGroup(),
      f.isSymlink() ? new Path(f.getSymlink()) : null,
      f.getFullPath(parent).makeQualified(getUri(), getWorkingDirectory()));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:WebHdfsFileSystem.java

示例4: toFileStatus

import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; //导入方法依赖的package包/类
static FileStatus toFileStatus(HdfsFileStatus f, String parent) {
  return new FileStatus(f.getLen(), f.isDir(), f.getReplication(),
      f.getBlockSize(), f.getModificationTime(), f.getAccessTime(),
      f.getPermission(), f.getOwner(), f.getGroup(),
      f.isSymlink() ? new Path(f.getSymlink()) : null,
      new Path(f.getFullName(parent)));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestJsonUtil.java


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