下面列出了怎么用org.apache.hadoop.fs.DF的API类实例代码及写法,或者点击链接到github查看源代码。
FsVolumeImpl(FsDatasetImpl dataset, String storageID, File currentDir,
Configuration conf, StorageType storageType) throws IOException {
this.dataset = dataset;
this.storageID = storageID;
this.reserved = conf.getLong(
DFSConfigKeys.DFS_DATANODE_DU_RESERVED_KEY,
DFSConfigKeys.DFS_DATANODE_DU_RESERVED_DEFAULT);
this.reservedForRbw = new AtomicLong(0L);
this.currentDir = currentDir;
File parent = currentDir.getParentFile();
this.usage = new DF(parent, conf);
this.storageType = storageType;
this.configuredCapacity = -1;
cacheExecutor = initializeCacheExecutor(parent);
}
FsVolumeImpl(FsDatasetImpl dataset, String storageID, File currentDir,
Configuration conf, StorageType storageType) throws IOException {
this.dataset = dataset;
this.storageID = storageID;
this.reserved = conf.getLong(
DFSConfigKeys.DFS_DATANODE_DU_RESERVED_KEY,
DFSConfigKeys.DFS_DATANODE_DU_RESERVED_DEFAULT);
this.reservedForRbw = new AtomicLong(0L);
this.currentDir = currentDir;
File parent = currentDir.getParentFile();
this.usage = new DF(parent, conf);
this.storageType = storageType;
this.configuredCapacity = -1;
cacheExecutor = initializeCacheExecutor(parent);
}
public void testVolumeSizeWithBytes() throws Exception {
Configuration conf = new Configuration();
File data_dir = MiniDFSCluster.getDataDirectory(conf);
// Need to create data_dir, otherwise DF doesn't work on non-existent dir.
data_dir.mkdirs();
DF df = new DF(data_dir, conf);
long reserved = 10000;
conf.setLong("dfs.datanode.du.reserved", reserved);
verifyVolumeSize(conf, reserved, df);
}
public void testVolumeSizeWithPercent() throws Exception {
Configuration conf = new Configuration();
File data_dir = MiniDFSCluster.getDataDirectory(conf);
// Need to create data_dir, otherwise DF doesn't work on non-existent dir.
data_dir.mkdirs();
DF df = new DF(data_dir, conf);
long reserved = (long) (df.getCapacity() * 0.215);
conf.setFloat("dfs.datanode.du.reserved.percent", 21.5f);
verifyVolumeSize(conf, reserved, df);
}
FSVolume(FSDataset dataset, File currentDir, Configuration conf) throws IOException {
this.currentDir = currentDir;
File parent = currentDir.getParentFile();
this.usage = new DF(parent, conf);
this.reserved = usage.getReserved();
this.dataset = dataset;
this.namespaceMap = new NamespaceMap();
this.dfsUsage = new DU(currentDir, conf);
this.dfsUsage.start();
}
public CheckedVolume(File dirToCheck, boolean required)
throws IOException {
df = new DF(dirToCheck, conf);
this.required = required;
volume = df.getFilesystem();
}
public CheckedVolume(File dirToCheck, boolean required)
throws IOException {
df = new DF(dirToCheck, conf);
this.required = required;
volume = df.getFilesystem();
}