• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LocatedBlockProto类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Translate类代码示例发布时间:2022-05-22
下一篇:
Java AnyImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap