本文整理汇总了Java中org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto类的典型用法代码示例。如果您正苦于以下问题:Java LocatedBlockProto类的具体用法?Java LocatedBlockProto怎么用?Java LocatedBlockProto使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocatedBlockProto类属于org.apache.hadoop.hdfs.protocol.proto.HdfsProtos包,在下文中一共展示了LocatedBlockProto类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convert
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
public static RecoveringBlockProto convert(RecoveringBlock b) {
if (b == null) {
return null;
}
LocatedBlockProto lb = PBHelperClient.convertLocatedBlock(b);
RecoveringBlockProto.Builder builder = RecoveringBlockProto.newBuilder();
builder.setBlock(lb).setNewGenStamp(b.getNewGenerationStamp());
if(b.getNewBlock() != null)
builder.setTruncateBlock(PBHelperClient.convert(b.getNewBlock()));
if (b instanceof RecoveringStripedBlock) {
RecoveringStripedBlock sb = (RecoveringStripedBlock) b;
builder.setEcPolicy(PBHelperClient.convertErasureCodingPolicy(
sb.getErasureCodingPolicy()));
builder.setBlockIndices(PBHelperClient.getByteString(sb.getBlockIndices()));
}
return builder.build();
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:PBHelper.java
示例2: convert
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
public static LocatedBlockProto convert(LocatedBlock b) {
if (b == null) {
return null;
}
Builder builder = LocatedBlockProto.newBuilder();
DatanodeInfo[] locs = b.getLocations();
for (int i = 0; i < locs.length; i++) {
builder.addLocs(i, PBHelper.convert(locs[i]));
//For compatability with newer clients
builder.addStorageIDs("HopsFS_Hack_Storage_ID" );
builder.addStorageTypes(HdfsProtos.StorageTypeProto.DISK);
builder.addIsCached(false);
}
builder = builder.setB(PBHelper.convert(b.getBlock()))
.setBlockToken(PBHelper.convert(b.getBlockToken()))
.setCorrupt(b.isCorrupt()).setOffset(b.getStartOffset());
if(b.isPhantomBlock() && b.isDataSet()){
builder.setData(ByteString.copyFrom(b.getData()));
}
return builder.build();
}
开发者ID:hopshadoop,项目名称:hops,代码行数:23,代码来源:PBHelper.java
示例3: convert
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
public static RecoveringBlockProto convert(RecoveringBlock b) {
if (b == null) {
return null;
}
LocatedBlockProto lb = PBHelper.convert((LocatedBlock)b);
RecoveringBlockProto.Builder builder = RecoveringBlockProto.newBuilder();
builder.setBlock(lb).setNewGenStamp(b.getNewGenerationStamp());
if(b.getNewBlock() != null)
builder.setTruncateBlock(PBHelper.convert(b.getNewBlock()));
return builder.build();
}
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:PBHelper.java
示例4: convertLocatedBlock
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
public static List<LocatedBlock> convertLocatedBlock(
List<LocatedBlockProto> lb) {
if (lb == null) return null;
final int len = lb.size();
List<LocatedBlock> result =
new ArrayList<LocatedBlock>(len);
for (int i = 0; i < len; ++i) {
result.add(PBHelper.convert(lb.get(i)));
}
return result;
}
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:PBHelper.java
示例5: convertLocatedBlock2
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
public static List<LocatedBlockProto> convertLocatedBlock2(List<LocatedBlock> lb) {
if (lb == null) return null;
final int len = lb.size();
List<LocatedBlockProto> result = new ArrayList<LocatedBlockProto>(len);
for (int i = 0; i < len; ++i) {
result.add(PBHelper.convert(lb.get(i)));
}
return result;
}
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:PBHelper.java
示例6: reportBadBlocks
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Override
public ReportBadBlocksResponseProto reportBadBlocks(RpcController controller,
ReportBadBlocksRequestProto request) throws ServiceException {
List<LocatedBlockProto> lbps = request.getBlocksList();
LocatedBlock [] blocks = new LocatedBlock [lbps.size()];
for(int i=0; i<lbps.size(); i++) {
blocks[i] = PBHelper.convert(lbps.get(i));
}
try {
impl.reportBadBlocks(blocks);
} catch (IOException e) {
throw new ServiceException(e);
}
return VOID_REPORT_BAD_BLOCK_RESPONSE;
}
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:DatanodeProtocolServerSideTranslatorPB.java
示例7: reportBadBlocks
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Override
public ReportBadBlocksResponseProto reportBadBlocks(RpcController controller,
ReportBadBlocksRequestProto req) throws ServiceException {
try {
List<LocatedBlockProto> bl = req.getBlocksList();
server.reportBadBlocks(PBHelper.convertLocatedBlock(
bl.toArray(new LocatedBlockProto[bl.size()])));
} catch (IOException e) {
throw new ServiceException(e);
}
return VOID_REP_BAD_BLOCK_RESPONSE;
}
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java
示例8: updateBlockForPipeline
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Override
public UpdateBlockForPipelineResponseProto updateBlockForPipeline(
RpcController controller, UpdateBlockForPipelineRequestProto req)
throws ServiceException {
try {
LocatedBlockProto result = PBHelper.convert(server
.updateBlockForPipeline(PBHelper.convert(req.getBlock()),
req.getClientName()));
return UpdateBlockForPipelineResponseProto.newBuilder().setBlock(result)
.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java
示例9: testConvertLocatedBlock
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Test
public void testConvertLocatedBlock() {
LocatedBlock lb = createLocatedBlock();
LocatedBlockProto lbProto = PBHelper.convert(lb);
LocatedBlock lb2 = PBHelper.convert(lbProto);
compare(lb,lb2);
}
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestPBHelper.java
示例10: testConvertLocatedBlockNoStorageMedia
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Test
public void testConvertLocatedBlockNoStorageMedia() {
LocatedBlock lb = createLocatedBlockNoStorageMedia();
LocatedBlockProto lbProto = PBHelper.convert(lb);
LocatedBlock lb2 = PBHelper.convert(lbProto);
compare(lb,lb2);
}
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestPBHelper.java
示例11: testConvertLocatedBlockList
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Test
public void testConvertLocatedBlockList() {
ArrayList<LocatedBlock> lbl = new ArrayList<LocatedBlock>();
for (int i=0;i<3;i++) {
lbl.add(createLocatedBlock());
}
List<LocatedBlockProto> lbpl = PBHelper.convertLocatedBlock2(lbl);
List<LocatedBlock> lbl2 = PBHelper.convertLocatedBlock(lbpl);
assertEquals(lbl.size(), lbl2.size());
for (int i=0;i<lbl.size();i++) {
compare(lbl.get(i), lbl2.get(2));
}
}
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestPBHelper.java
示例12: testConvertLocatedBlockArray
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Test
public void testConvertLocatedBlockArray() {
LocatedBlock [] lbl = new LocatedBlock[3];
for (int i=0;i<3;i++) {
lbl[i] = createLocatedBlock();
}
LocatedBlockProto [] lbpl = PBHelper.convertLocatedBlock(lbl);
LocatedBlock [] lbl2 = PBHelper.convertLocatedBlock(lbpl);
assertEquals(lbl.length, lbl2.length);
for (int i=0;i<lbl.length;i++) {
compare(lbl[i], lbl2[i]);
}
}
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestPBHelper.java
示例13: convertLocatedBlocks
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
public static List<LocatedBlock> convertLocatedBlocks(
List<LocatedBlockProto> lb) {
if (lb == null) return null;
final int len = lb.size();
List<LocatedBlock> result = new ArrayList<>(len);
for (LocatedBlockProto aLb : lb) {
result.add(convertLocatedBlockProto(aLb));
}
return result;
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:11,代码来源:PBHelperClient.java
示例14: convertLocatedBlocks2
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
public static List<LocatedBlockProto> convertLocatedBlocks2(
List<LocatedBlock> lb) {
if (lb == null) return null;
final int len = lb.size();
List<LocatedBlockProto> result = new ArrayList<>(len);
for (LocatedBlock aLb : lb) {
result.add(convertLocatedBlock(aLb));
}
return result;
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:11,代码来源:PBHelperClient.java
示例15: convertLocatedBlock
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
public static List<LocatedBlock> convertLocatedBlock(
List<LocatedBlockProto> lb) {
if (lb == null) return null;
final int len = lb.size();
List<LocatedBlock> result = new ArrayList<>(len);
for (LocatedBlockProto aLb : lb) {
result.add(convertLocatedBlockProto(aLb));
}
return result;
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:11,代码来源:PBHelperClient.java
示例16: reportBadBlocks
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Override
public ReportBadBlocksResponseProto reportBadBlocks(RpcController controller,
ReportBadBlocksRequestProto request) throws ServiceException {
List<LocatedBlockProto> lbps = request.getBlocksList();
LocatedBlock [] blocks = new LocatedBlock [lbps.size()];
for(int i=0; i<lbps.size(); i++) {
blocks[i] = PBHelperClient.convertLocatedBlockProto(lbps.get(i));
}
try {
impl.reportBadBlocks(blocks);
} catch (IOException e) {
throw new ServiceException(e);
}
return VOID_REPORT_BAD_BLOCK_RESPONSE;
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:DatanodeProtocolServerSideTranslatorPB.java
示例17: reportBadBlocks
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Override
public ReportBadBlocksResponseProto reportBadBlocks(RpcController controller,
ReportBadBlocksRequestProto req) throws ServiceException {
try {
List<LocatedBlockProto> bl = req.getBlocksList();
server.reportBadBlocks(PBHelperClient.convertLocatedBlocks(
bl.toArray(new LocatedBlockProto[bl.size()])));
} catch (IOException e) {
throw new ServiceException(e);
}
return VOID_REP_BAD_BLOCK_RESPONSE;
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:13,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java
示例18: updateBlockForPipeline
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Override
public UpdateBlockForPipelineResponseProto updateBlockForPipeline(
RpcController controller, UpdateBlockForPipelineRequestProto req)
throws ServiceException {
try {
LocatedBlockProto result = PBHelperClient.convertLocatedBlock(
server.updateBlockForPipeline(PBHelperClient.convert(req.getBlock()),
req.getClientName()));
return UpdateBlockForPipelineResponseProto.newBuilder().setBlock(result)
.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java
示例19: testConvertLocatedBlock
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Test
public void testConvertLocatedBlock() {
LocatedBlock lb = createLocatedBlock();
LocatedBlockProto lbProto = PBHelperClient.convertLocatedBlock(lb);
LocatedBlock lb2 = PBHelperClient.convertLocatedBlockProto(lbProto);
compare(lb,lb2);
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:8,代码来源:TestPBHelper.java
示例20: testConvertLocatedBlockNoStorageMedia
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; //导入依赖的package包/类
@Test
public void testConvertLocatedBlockNoStorageMedia() {
LocatedBlock lb = createLocatedBlockNoStorageMedia();
LocatedBlockProto lbProto = PBHelperClient.convertLocatedBlock(lb);
LocatedBlock lb2 = PBHelperClient.convertLocatedBlockProto(lbProto);
compare(lb,lb2);
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:8,代码来源:TestPBHelper.java
注:本文中的org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论