本文整理汇总了Java中org.apache.hadoop.fs.FsStatus类的典型用法代码示例。如果您正苦于以下问题:Java FsStatus类的具体用法?Java FsStatus怎么用?Java FsStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FsStatus类属于org.apache.hadoop.fs包,在下文中一共展示了FsStatus类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
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());
}
示例2: processPath
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
@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)
);
}
示例3: getStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
/**
* 此方法用于获取文件的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;
}
示例4: getStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
@Override
public FsStatus getStatus() throws IOException {
try {
return underlyingFs.getStatus();
} catch(FSError e) {
throw propagateFSError(e);
}
}
示例5: testStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
/** @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());
}
示例6: getDiskStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
/**
* @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]);
}
示例7: getStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
@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;
}
示例8: getStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
@Override
public FsStatus getStatus(Path p) throws IOException {
return super.getStatus(fullPath(p));
}
示例9: getFsStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
@Override
public FsStatus getFsStatus() throws IOException {
return myFs.getFsStatus();
}
示例10: getFsStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
@Override
public FsStatus getFsStatus() throws AccessControlException,
FileNotFoundException, IOException {
return new FsStatus(0, 0, 0);
}
示例11: getStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
@Override
public FsStatus getStatus() throws IOException {
return underlyingFs.getStatus();
}
示例12: getDiskStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
/**
* @see ClientProtocol#getStats()
*/
public FsStatus getDiskStatus() throws IOException {
long rawNums[] = callGetStats();
return new FsStatus(rawNums[0], rawNums[1], rawNums[2]);
}
示例13: DiskStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
public DiskStatus(FsStatus stats) {
super(stats.getCapacity(), stats.getUsed(), stats.getRemaining());
}
示例14: getStatus
import org.apache.hadoop.fs.FsStatus; //导入依赖的package包/类
@Override
public FsStatus getStatus(Path p) throws IOException {
statistics.incrementReadOps(1);
return dfs.getDiskStatus();
}