Java 类org.apache.hadoop.fs.FsStatus 实例源码

项目:Hue-Ctrip-DI    文件:TestMain.java   
public void test() throws IOException {
    Configuration conf = new Configuration();
    conf.addResource("conf/hdfs/test-hdfs-client-conf.xml");

    System.setProperty("HADOOP_USER_NAME", "hdfs");
    DistributedFileSystem fs = (DistributedFileSystem) FileSystem.get(conf);

    DatanodeInfo[] dataNodeStatus = fs.getDataNodeStats();
    for (DatanodeInfo dninfo : dataNodeStatus) {
        System.out.println(dninfo.getHostName() + ", Is Decommission:"
                + dninfo.isDecommissioned());
        System.out.println(dninfo.getHostName() + ", Dump Data node:"
                + dninfo.dumpDatanode());
    }
    System.out.println("Default block size:" + fs.getDefaultBlockSize());
    ContentSummary contentSummary = fs.getContentSummary(new Path("/"));
    System.out.println("Content Summary:" + contentSummary);

    FsStatus fsstatus = fs.getStatus();

    System.out.println(fsstatus.getCapacity());
}
项目:hadoop-oss    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:alluxio    文件:HdfsAndAlluxioUtils_update.java   
/**
 * 此方法用于获取文件的FsStatus
 *
 * @param fileSystemInfo
 *            文件系统信息
 * @param path
 *            文件路径
 * @return FsStatus
 */
public static FsStatus getStatus(FileSystemInfo fileSystemInfo, String path) {
    FileSystem fs = getFileSystem(fileSystemInfo);
    Path uri = new Path(path);
    try {
        pathNotExistCheck(path, fs, uri);
        return fs.getStatus(uri);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        closeFileSystem(fs);
    }
    return null;
}
项目:hadoop    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:dremio-oss    文件:FileSystemWrapper.java   
@Override
public FsStatus getStatus() throws IOException {
  try {
    return underlyingFs.getStatus();
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
项目:dremio-oss    文件:FileSystemWrapper.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  try {
    return underlyingFs.getStatus(p);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
项目:aliyun-oss-hadoop-fs    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:big-c    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:hadoop-plus    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:ignite    文件:HadoopIgfs20FileSystemAbstractSelfTest.java   
/** @throws Exception If failed. */
public void testStatus() throws Exception {
    Path file1 = new Path("/file1");

    try (FSDataOutputStream file = fs.create(file1, EnumSet.noneOf(CreateFlag.class),
        Options.CreateOpts.perms(FsPermission.getDefault()))) {
        file.write(new byte[1024 * 1024]);
    }

    FsStatus status = fs.getFsStatus();

    assertEquals(getClientFsUser(), fs.getFileStatus(file1).getOwner());

    assertEquals(4, grid(0).cluster().nodes().size());

    long used = 0, max = 0;

    for (int i = 0; i < 4; i++) {
        IgniteFileSystem igfs = grid(i).fileSystem("igfs");

        IgfsMetrics metrics = igfs.metrics();

        used += metrics.localSpaceSize();
        max += metrics.maxSpaceSize();
    }

    assertEquals(used, status.getUsed());
    assertEquals(max, status.getCapacity());
}
项目:hops    文件:DFSClient.java   
/**
 * @see ClientProtocol#getStats()
 */
public FsStatus getDiskStatus() throws IOException {
  ClientActionHandler handler = new ClientActionHandler() {
    @Override
    public Object doAction(ClientProtocol namenode)
        throws RemoteException, IOException {
      return namenode.getStats();
    }
  };
  long rawNums[] = (long[]) doClientActionWithRetry(handler, "getDiskStatus");
  return new FsStatus(rawNums[0], rawNums[1], rawNums[2]);
}
项目:hops    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:hadoop-TCP    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:cephfs-hadoop    文件:CephFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
 CephStatVFS stat = new CephStatVFS();
 ceph.statfs(p, stat);

 FsStatus status = new FsStatus(stat.bsize * stat.blocks, 
        stat.bsize * (stat.blocks - stat.bavail),
        stat.bsize * stat.bavail);
 return status;
}
项目:hardfs    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:hadoop-on-lustre2    文件:FsUsage.java   
@Override
protected void processPath(PathData item) throws IOException {
  FsStatus fsStats = item.fs.getStatus(item.path);
  long size = fsStats.getCapacity();
  long used = fsStats.getUsed();
  long free = fsStats.getRemaining();

  usagesTable.addRow(
      item.fs.getUri(),
      formatSize(size),
      formatSize(used),
      formatSize(free),
      StringUtils.formatPercent((double)used/(double)size, 0)
  );
}
项目:hadoop-oss    文件:ChRootedFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  return super.getStatus(fullPath(p));
}
项目:hadoop-oss    文件:ChRootedFs.java   
@Override
public FsStatus getFsStatus() throws IOException {
  return myFs.getFsStatus();
}
项目:hadoop-oss    文件:ViewFs.java   
@Override
public FsStatus getFsStatus() throws AccessControlException,
    FileNotFoundException, IOException {
  return new FsStatus(0, 0, 0);
}
项目:hadoop-oss    文件:ViewFs.java   
@Override
public FsStatus getFsStatus() {
  return new FsStatus(0, 0, 0);
}
项目:QDrill    文件:DrillFileSystem.java   
@Override
public FsStatus getStatus() throws IOException {
  return underlyingFs.getStatus();
}
项目:QDrill    文件:DrillFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  return underlyingFs.getStatus(p);
}
项目:hadoop    文件:DFSClient.java   
/**
 * @see ClientProtocol#getStats()
 */
public FsStatus getDiskStatus() throws IOException {
  long rawNums[] = callGetStats();
  return new FsStatus(rawNums[0], rawNums[1], rawNums[2]);
}
项目:hadoop    文件:DistributedFileSystem.java   
public DiskStatus(FsStatus stats) {
  super(stats.getCapacity(), stats.getUsed(), stats.getRemaining());
}
项目:hadoop    文件:DistributedFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  statistics.incrementReadOps(1);
  return dfs.getDiskStatus();
}
项目:hadoop    文件:ChRootedFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  return super.getStatus(fullPath(p));
}
项目:hadoop    文件:ChRootedFs.java   
@Override
public FsStatus getFsStatus() throws IOException {
  return myFs.getFsStatus();
}
项目:hadoop    文件:ViewFs.java   
@Override
public FsStatus getFsStatus() throws AccessControlException,
    FileNotFoundException, IOException {
  return new FsStatus(0, 0, 0);
}
项目:hadoop    文件:ViewFs.java   
@Override
public FsStatus getFsStatus() {
  return new FsStatus(0, 0, 0);
}
项目:aliyun-oss-hadoop-fs    文件:DFSClient.java   
/**
 * @see ClientProtocol#getStats()
 */
public FsStatus getDiskStatus() throws IOException {
  long rawNums[] = callGetStats();
  return new FsStatus(rawNums[0], rawNums[1], rawNums[2]);
}
项目:aliyun-oss-hadoop-fs    文件:DistributedFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  statistics.incrementReadOps(1);
  return dfs.getDiskStatus();
}
项目:aliyun-oss-hadoop-fs    文件:ChRootedFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  return super.getStatus(fullPath(p));
}
项目:aliyun-oss-hadoop-fs    文件:ChRootedFs.java   
@Override
public FsStatus getFsStatus() throws IOException {
  return myFs.getFsStatus();
}
项目:aliyun-oss-hadoop-fs    文件:ViewFs.java   
@Override
public FsStatus getFsStatus() throws AccessControlException,
    FileNotFoundException, IOException {
  return new FsStatus(0, 0, 0);
}
项目:aliyun-oss-hadoop-fs    文件:ViewFs.java   
@Override
public FsStatus getFsStatus() {
  return new FsStatus(0, 0, 0);
}
项目:big-c    文件:DFSClient.java   
/**
 * @see ClientProtocol#getStats()
 */
public FsStatus getDiskStatus() throws IOException {
  long rawNums[] = callGetStats();
  return new FsStatus(rawNums[0], rawNums[1], rawNums[2]);
}
项目:big-c    文件:DistributedFileSystem.java   
public DiskStatus(FsStatus stats) {
  super(stats.getCapacity(), stats.getUsed(), stats.getRemaining());
}
项目:big-c    文件:DistributedFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  statistics.incrementReadOps(1);
  return dfs.getDiskStatus();
}
项目:big-c    文件:ChRootedFileSystem.java   
@Override
public FsStatus getStatus(Path p) throws IOException {
  return super.getStatus(fullPath(p));
}