本文整理汇总了Java中org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus类的典型用法代码示例。如果您正苦于以下问题:Java HdfsLocatedFileStatus类的具体用法?Java HdfsLocatedFileStatus怎么用?Java HdfsLocatedFileStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HdfsLocatedFileStatus类属于org.apache.hadoop.hdfs.protocol包,在下文中一共展示了HdfsLocatedFileStatus类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: hasNext
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean hasNext() throws IOException {
while (curStat == null && hasNextNoFilter()) {
T next;
HdfsFileStatus fileStat = thisListing.getPartialListing()[i++];
if (needLocation) {
next = (T)((HdfsLocatedFileStatus)fileStat)
.makeQualifiedLocated(getUri(), p);
} else {
next = (T)fileStat.makeQualified(getUri(), p);
}
// apply filter if not null
if (filter == null || filter.accept(next.getPath())) {
curStat = next;
}
}
return curStat != null;
}
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:DistributedFileSystem.java
示例2: convert
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
if (fs == null)
return null;
return new HdfsLocatedFileStatus(
fs.getLength(), fs.getFileType().equals(FileType.IS_DIR),
fs.getBlockReplication(), fs.getBlocksize(),
fs.getModificationTime(), fs.getAccessTime(),
PBHelper.convert(fs.getPermission()), fs.getOwner(), fs.getGroup(),
fs.getFileType().equals(FileType.IS_SYMLINK) ?
fs.getSymlink().toByteArray() : null,
fs.getPath().toByteArray(),
fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID,
fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
fs.hasChildrenNum() ? fs.getChildrenNum() : -1,
fs.hasFileEncryptionInfo() ? convert(fs.getFileEncryptionInfo()) : null,
fs.hasStoragePolicy() ? (byte) fs.getStoragePolicy()
: BlockStoragePolicySuite.ID_UNSPECIFIED);
}
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:PBHelper.java
示例3: verifyFile
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
private void verifyFile(final Path parent, final HdfsFileStatus status,
final Byte expectedPolicyId) throws Exception {
HdfsLocatedFileStatus fileStatus = (HdfsLocatedFileStatus) status;
byte policyId = fileStatus.getStoragePolicy();
BlockStoragePolicy policy = policies.getPolicy(policyId);
if (expectedPolicyId != null) {
Assert.assertEquals((byte)expectedPolicyId, policy.getId());
}
final List<StorageType> types = policy.chooseStorageTypes(
status.getReplication());
for(LocatedBlock lb : fileStatus.getBlockLocations().getLocatedBlocks()) {
final Mover.StorageTypeDiff diff = new Mover.StorageTypeDiff(types,
lb.getStorageTypes());
Assert.assertTrue(fileStatus.getFullName(parent.toString())
+ " with policy " + policy + " has non-empty overlap: " + diff
+ ", the corresponding block is " + lb.getBlock().getLocalBlock(),
diff.removeOverlap(true));
}
}
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestStorageMover.java
示例4: hasNext
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean hasNext() throws IOException {
while (curStat == null && hasNextNoFilter()) {
T next;
HdfsFileStatus fileStat = thisListing.getPartialListing()[i++];
if (needLocation) {
next = (T)((HdfsLocatedFileStatus)fileStat)
.makeQualifiedLocated(getUri(), p);
} else {
next = (T)fileStat.makeQualified(getUri(), p);
}
// apply filter if not null
if (filter == null || filter.accept(next.getPath())) {
curStat = next;
}
}
return curStat != null;
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:DistributedFileSystem.java
示例5: convert
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
if (fs == null)
return null;
return new HdfsLocatedFileStatus(
fs.getLength(), fs.getFileType().equals(FileType.IS_DIR),
fs.getBlockReplication(), fs.getBlocksize(),
fs.getModificationTime(), fs.getAccessTime(),
convert(fs.getPermission()), fs.getOwner(), fs.getGroup(),
fs.getFileType().equals(FileType.IS_SYMLINK) ?
fs.getSymlink().toByteArray() : null,
fs.getPath().toByteArray(),
fs.hasFileId()? fs.getFileId(): HdfsConstants.GRANDFATHER_INODE_ID,
fs.hasLocations() ? convert(fs.getLocations()) : null,
fs.hasChildrenNum() ? fs.getChildrenNum() : -1,
fs.hasFileEncryptionInfo() ? convert(fs.getFileEncryptionInfo()) : null,
fs.hasStoragePolicy() ? (byte) fs.getStoragePolicy()
: HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED,
fs.hasEcPolicy() ? convertErasureCodingPolicy(fs.getEcPolicy()) : null);
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:PBHelperClient.java
示例6: listLocatedStatus
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
@Override
public RemoteIterator<LocatedFileStatus> listLocatedStatus(
final Path p)
throws FileNotFoundException, IOException {
return new DirListingIterator<LocatedFileStatus>(p, true) {
@Override
public LocatedFileStatus next() throws IOException {
return ((HdfsLocatedFileStatus)getNext()).makeQualifiedLocated(
getUri(), p);
}
};
}
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:Hdfs.java
示例7: createLocatedFileStatus
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
/**
* Create FileStatus with location info by file INode
*/
private HdfsLocatedFileStatus createLocatedFileStatus(byte[] path,
INode node, Snapshot snapshot) throws IOException {
assert hasReadLock();
long size = 0; // length is zero for directories
short replication = 0;
long blocksize = 0;
LocatedBlocks loc = null;
if (node.isFile()) {
final INodeFile fileNode = node.asFile();
size = fileNode.computeFileSize(snapshot);
replication = fileNode.getFileReplication(snapshot);
blocksize = fileNode.getPreferredBlockSize();
final boolean inSnapshot = snapshot != null;
final boolean isUc = inSnapshot ? false : fileNode.isUnderConstruction();
final long fileSize = !inSnapshot && isUc ?
fileNode.computeFileSizeNotIncludingLastUcBlock() : size;
loc = getFSNamesystem().getBlockManager().createLocatedBlocks(
fileNode.getBlocks(), fileSize, isUc, 0L, size, false,
inSnapshot);
if (loc == null) {
loc = new LocatedBlocks();
}
}
int childrenNum = node.isDirectory() ?
node.asDirectory().getChildrenNum(snapshot) : 0;
return new HdfsLocatedFileStatus(size, node.isDirectory(), replication,
blocksize, node.getModificationTime(snapshot),
node.getAccessTime(snapshot), node.getFsPermission(snapshot),
node.getUserName(snapshot), node.getGroupName(snapshot),
node.isSymlink() ? node.asSymlink().getSymlink() : null, path,
node.getId(), loc, childrenNum);
}
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:38,代码来源:FSDirectory.java
示例8: convert
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
if (fs == null)
return null;
return new HdfsLocatedFileStatus(
fs.getLength(), fs.getFileType().equals(FileType.IS_DIR),
fs.getBlockReplication(), fs.getBlocksize(),
fs.getModificationTime(), fs.getAccessTime(),
PBHelper.convert(fs.getPermission()), fs.getOwner(), fs.getGroup(),
fs.getFileType().equals(FileType.IS_SYMLINK) ?
fs.getSymlink().toByteArray() : null,
fs.getPath().toByteArray(),
fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID,
fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
fs.hasChildrenNum() ? fs.getChildrenNum() : 0);
}
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:16,代码来源:PBHelper.java
示例9: makeQualifiedLocated
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
private LocatedFileStatus makeQualifiedLocated(HdfsLocatedFileStatus f,
Path parent) throws IOException {
return new LocatedFileStatus(f.getLen(), f.isDir(), f.getReplication(),
f.getBlockSize(), f.getModificationTime(), f.getAccessTime(),
f.getPermission(), f.getOwner(), f.getGroup(),
f.isSymlink() ? f.getSymlink() : null,
(f.getFullPath(parent)).makeQualified(getUri(), null),
// fully-qualify path
DFSUtil.locatedBlocks2Locations(f.getBlockLocations()));
}
开发者ID:hopshadoop,项目名称:hops,代码行数:11,代码来源:Hdfs.java
示例10: listLocatedStatus
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
@Override
public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path p)
throws FileNotFoundException, IOException {
return new DirListingIterator<LocatedFileStatus>(p, true) {
@Override
public LocatedFileStatus next() throws IOException {
return makeQualifiedLocated((HdfsLocatedFileStatus) getNext(), p);
}
};
}
开发者ID:hopshadoop,项目名称:hops,代码行数:12,代码来源:Hdfs.java
示例11: makeQualifiedLocated
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
private LocatedFileStatus makeQualifiedLocated(HdfsLocatedFileStatus f,
Path parent) {
return new LocatedFileStatus(f.getLen(), f.isDir(), f.getReplication(),
f.getBlockSize(), f.getModificationTime(), f.getAccessTime(),
f.getPermission(), f.getOwner(), f.getGroup(), null,
(f.getFullPath(parent)).makeQualified(getUri(), getWorkingDirectory()),
// fully-qualify path
DFSUtil.locatedBlocks2Locations(f.getBlockLocations()));
}
开发者ID:hopshadoop,项目名称:hops,代码行数:10,代码来源:DistributedFileSystem.java
示例12: createLocatedFileStatus
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
/**
* Create FileStatus with location info by file INode
*/
private HdfsLocatedFileStatus createLocatedFileStatus(byte[] path, INode node)
throws IOException, StorageException {
long size = 0; // length is zero for directories
short replication = 0;
long blocksize = 0;
LocatedBlocks loc = null;
boolean isFileStoredInDB = false;
if (node instanceof INodeFile) {
INodeFile fileNode = (INodeFile) node;
isFileStoredInDB = fileNode.isFileStoredInDB();
if(isFileStoredInDB){
size = fileNode.getSize();
}else{
size = fileNode.computeFileSize(true);
}
replication = fileNode.getBlockReplication();
blocksize = fileNode.getPreferredBlockSize();
if(isFileStoredInDB){
loc = getFSNamesystem().getBlockManager().createPhantomLocatedBlocks(fileNode,null,fileNode.isUnderConstruction(),false);
}else {
loc = getFSNamesystem().getBlockManager()
.createLocatedBlocks(fileNode.getBlocks(),
fileNode.computeFileSize(false), fileNode.isUnderConstruction(),
0L, size, false);
}
if (loc == null) {
loc = new LocatedBlocks();
}
}
return new HdfsLocatedFileStatus(node.getId(), size, node.isDirectory(), replication,
blocksize, node.getModificationTime(), node.getAccessTime(),
node.getFsPermission(), node.getUserName(), node.getGroupName(),
node.isSymlink() ? ((INodeSymlink) node).getSymlink() : null, path,
loc, isFileStoredInDB);
}
开发者ID:hopshadoop,项目名称:hops,代码行数:42,代码来源:FSDirectory.java
示例13: convert
import org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus; //导入依赖的package包/类
public static HdfsFileStatus convert(HdfsFileStatusProto fs) throws IOException {
if (fs == null) {
return null;
}
return new HdfsLocatedFileStatus(fs.getFileId(), fs.getLength(),
fs.getFileType().equals(FileType.IS_DIR), fs.getBlockReplication(),
fs.getBlocksize(), fs.getModificationTime(), fs.getAccessTime(),
PBHelper.convert(fs.getPermission()), fs.getOwner(), fs.getGroup(),
fs.getFileType().equals(FileType.IS_SYMLINK) ?
fs.getSymlink().toByteArray() : null, fs.getPath().toByteArray(),
fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
fs.hasIsFileStoredInDB() ? fs.getIsFileStoredInDB() : false);
}
开发者ID:hopshadoop,项目名称:hops,代码行数:15,代码来源:PBHelper.java
注:本文中的org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论