Java Code Examples for org.apache.hadoop.fs.FsStatus#getCapacity()

The following examples show how to use org.apache.hadoop.fs.FsStatus#getCapacity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HdfsBackedSortedSet.java    From datawave with Apache License 2.0 6 votes vote down vote up
public boolean isValid() {
    FsStatus fsStatus = null;
    try {
        fsStatus = ivaratorCacheDir.getFs().getStatus();
    } catch (IOException e) {
        log.warn("Unable to determine status of the filesystem: " + ivaratorCacheDir.getFs());
    }
    
    // determine whether this fs is a good candidate
    if (fsStatus != null) {
        long availableStorageMiB = fsStatus.getRemaining() / 0x100000L;
        double availableStoragePercent = (double) fsStatus.getRemaining() / fsStatus.getCapacity();
        
        // if we are using less than our storage limit, the cache dir is valid
        return availableStorageMiB >= ivaratorCacheDir.getConfig().getMinAvailableStorageMiB()
                        && availableStoragePercent >= ivaratorCacheDir.getConfig().getMinAvailableStoragePercent();
    }
    
    return false;
}
 
Example 2
Source File: FsUsage.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@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)
  );
}
 
Example 3
Source File: FsUsage.java    From big-c with Apache License 2.0 5 votes vote down vote up
@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)
  );
}
 
Example 4
Source File: DistributedFileSystem.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public DiskStatus(FsStatus stats) {
  super(stats.getCapacity(), stats.getUsed(), stats.getRemaining());
}
 
Example 5
Source File: DistributedFileSystem.java    From big-c with Apache License 2.0 4 votes vote down vote up
public DiskStatus(FsStatus stats) {
  super(stats.getCapacity(), stats.getUsed(), stats.getRemaining());
}
 
Example 6
Source File: HadoopFileStore.java    From jsr203-hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public long getUnallocatedSpace() throws IOException {
  FsStatus status = this.system.getHDFS().getStatus();
  return status.getCapacity() - status.getUsed();
}