Java 类org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ExtendedBlockProto 实例源码

项目:hadoop    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
 return ExtendedBlockProto.newBuilder().
    setPoolId(b.getBlockPoolId()).
    setBlockId(b.getBlockId()).
    setNumBytes(b.getNumBytes()).
    setGenerationStamp(b.getGenerationStamp()).
    build();
}
项目:hadoop    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
  return ExtendedBlockProto.newBuilder().
      setPoolId(b.getBlockPoolId()).
      setBlockId(b.getBlockId()).
      setNumBytes(b.getNumBytes()).
      setGenerationStamp(b.getGenerationStamp()).
      build();
}
项目:aliyun-oss-hadoop-fs    文件:PBHelper.java   
public static BlockECRecoveryInfo convertBlockECRecoveryInfo(
    BlockECRecoveryInfoProto blockEcRecoveryInfoProto) {
  ExtendedBlockProto blockProto = blockEcRecoveryInfoProto.getBlock();
  ExtendedBlock block = PBHelperClient.convert(blockProto);

  DatanodeInfosProto sourceDnInfosProto = blockEcRecoveryInfoProto
      .getSourceDnInfos();
  DatanodeInfo[] sourceDnInfos = PBHelperClient.convert(sourceDnInfosProto);

  DatanodeInfosProto targetDnInfosProto = blockEcRecoveryInfoProto
      .getTargetDnInfos();
  DatanodeInfo[] targetDnInfos = PBHelperClient.convert(targetDnInfosProto);

  HdfsProtos.StorageUuidsProto targetStorageUuidsProto = blockEcRecoveryInfoProto
      .getTargetStorageUuids();
  String[] targetStorageUuids = convert(targetStorageUuidsProto);

  StorageTypesProto targetStorageTypesProto = blockEcRecoveryInfoProto
      .getTargetStorageTypes();
  StorageType[] convertStorageTypes = PBHelperClient.convertStorageTypes(
      targetStorageTypesProto.getStorageTypesList(), targetStorageTypesProto
          .getStorageTypesList().size());

  byte[] liveBlkIndices = blockEcRecoveryInfoProto.getLiveBlockIndices()
      .toByteArray();
  ErasureCodingPolicy ecPolicy =
      PBHelperClient.convertErasureCodingPolicy(
          blockEcRecoveryInfoProto.getEcPolicy());
  return new BlockECRecoveryInfo(block, sourceDnInfos, targetDnInfos,
      targetStorageUuids, convertStorageTypes, liveBlkIndices, ecPolicy);
}
项目:aliyun-oss-hadoop-fs    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelperClient.convert(b);
  ExtendedBlock b1 = PBHelperClient.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelperClient.convert(b);
  b1 = PBHelperClient.convert(bProto);
  assertEquals(b, b1);
}
项目:big-c    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
 return ExtendedBlockProto.newBuilder().
    setPoolId(b.getBlockPoolId()).
    setBlockId(b.getBlockId()).
    setNumBytes(b.getNumBytes()).
    setGenerationStamp(b.getGenerationStamp()).
    build();
}
项目:big-c    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
 return ExtendedBlockProto.newBuilder().
    setPoolId(b.getBlockPoolId()).
    setBlockId(b.getBlockId()).
    setNumBytes(b.getNumBytes()).
    setGenerationStamp(b.getGenerationStamp()).
    build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:hadoop-plus    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
 return ExtendedBlockProto.newBuilder().
    setPoolId(b.getBlockPoolId()).
    setBlockId(b.getBlockId()).
    setNumBytes(b.getNumBytes()).
    setGenerationStamp(b.getGenerationStamp()).
    build();
}
项目:hadoop-plus    文件:ClientDatanodeProtocolTranslatorPB.java   
@Override
public HdfsBlocksMetadata getHdfsBlocksMetadata(List<ExtendedBlock> blocks,
    List<Token<BlockTokenIdentifier>> tokens) throws IOException {
  // Convert to proto objects
  List<ExtendedBlockProto> blocksProtos = 
      new ArrayList<ExtendedBlockProto>(blocks.size());
  List<TokenProto> tokensProtos = 
      new ArrayList<TokenProto>(tokens.size());
  for (ExtendedBlock b : blocks) {
    blocksProtos.add(PBHelper.convert(b));
  }
  for (Token<BlockTokenIdentifier> t : tokens) {
    tokensProtos.add(PBHelper.convert(t));
  }
  // Build the request
  GetHdfsBlockLocationsRequestProto request = 
      GetHdfsBlockLocationsRequestProto.newBuilder()
      .addAllBlocks(blocksProtos)
      .addAllTokens(tokensProtos)
      .build();
  // Send the RPC
  GetHdfsBlockLocationsResponseProto response;
  try {
    response = rpcProxy.getHdfsBlockLocations(NULL_CONTROLLER, request);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
  // List of volumes in the response
  List<ByteString> volumeIdsByteStrings = response.getVolumeIdsList();
  List<byte[]> volumeIds = new ArrayList<byte[]>(volumeIdsByteStrings.size());
  for (ByteString bs : volumeIdsByteStrings) {
    volumeIds.add(bs.toByteArray());
  }
  // Array of indexes into the list of volumes, one per block
  List<Integer> volumeIndexes = response.getVolumeIndexesList();
  // Parsed HdfsVolumeId values, one per block
  return new HdfsBlocksMetadata(blocks.toArray(new ExtendedBlock[] {}), 
      volumeIds, volumeIndexes);
}
项目:hadoop-plus    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:FlexMap    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
 return ExtendedBlockProto.newBuilder().
    setPoolId(b.getBlockPoolId()).
    setBlockId(b.getBlockId()).
    setNumBytes(b.getNumBytes()).
    setGenerationStamp(b.getGenerationStamp()).
    build();
}
项目:FlexMap    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:hops    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) {
    return null;
  }
  return new ExtendedBlock(eb.getPoolId(), eb.getBlockId(), eb.getNumBytes(),
      eb.getGenerationStamp());
}
项目:hops    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) {
    return null;
  }
  return ExtendedBlockProto.newBuilder().
      setPoolId(b.getBlockPoolId()).
      setBlockId(b.getBlockId()).
      setNumBytes(b.getNumBytes()).
      setGenerationStamp(b.getGenerationStamp()).
      build();
}
项目:hops    文件:ClientDatanodeProtocolTranslatorPB.java   
@Override
public HdfsBlocksMetadata getHdfsBlocksMetadata(List<ExtendedBlock> blocks,
    List<Token<BlockTokenIdentifier>> tokens) throws IOException {
  // Convert to proto objects
  List<ExtendedBlockProto> blocksProtos =
      new ArrayList<>(blocks.size());
  List<TokenProto> tokensProtos = new ArrayList<>(tokens.size());
  for (ExtendedBlock b : blocks) {
    blocksProtos.add(PBHelper.convert(b));
  }
  for (Token<BlockTokenIdentifier> t : tokens) {
    tokensProtos.add(PBHelper.convert(t));
  }
  // Build the request
  GetHdfsBlockLocationsRequestProto request =
      GetHdfsBlockLocationsRequestProto.newBuilder()
          .addAllBlocks(blocksProtos).addAllTokens(tokensProtos).build();
  // Send the RPC
  GetHdfsBlockLocationsResponseProto response;
  try {
    response = rpcProxy.getHdfsBlockLocations(NULL_CONTROLLER, request);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
  // List of volumes in the response
  List<ByteString> volumeIdsByteStrings = response.getVolumeIdsList();
  List<byte[]> volumeIds = new ArrayList<>(volumeIdsByteStrings.size());
  for (ByteString bs : volumeIdsByteStrings) {
    volumeIds.add(bs.toByteArray());
  }
  // Array of indexes into the list of volumes, one per block
  List<Integer> volumeIndexes = response.getVolumeIndexesList();
  // Parsed HdfsVolumeId values, one per block
  return new HdfsBlocksMetadata(blocks.toArray(new ExtendedBlock[]{}),
      volumeIds, volumeIndexes);
}
项目:hops    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:hadoop-TCP    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
 return ExtendedBlockProto.newBuilder().
    setPoolId(b.getBlockPoolId()).
    setBlockId(b.getBlockId()).
    setNumBytes(b.getNumBytes()).
    setGenerationStamp(b.getGenerationStamp()).
    build();
}
项目:hadoop-TCP    文件:ClientDatanodeProtocolTranslatorPB.java   
@Override
public HdfsBlocksMetadata getHdfsBlocksMetadata(List<ExtendedBlock> blocks,
    List<Token<BlockTokenIdentifier>> tokens) throws IOException {
  // Convert to proto objects
  List<ExtendedBlockProto> blocksProtos = 
      new ArrayList<ExtendedBlockProto>(blocks.size());
  List<TokenProto> tokensProtos = 
      new ArrayList<TokenProto>(tokens.size());
  for (ExtendedBlock b : blocks) {
    blocksProtos.add(PBHelper.convert(b));
  }
  for (Token<BlockTokenIdentifier> t : tokens) {
    tokensProtos.add(PBHelper.convert(t));
  }
  // Build the request
  GetHdfsBlockLocationsRequestProto request = 
      GetHdfsBlockLocationsRequestProto.newBuilder()
      .addAllBlocks(blocksProtos)
      .addAllTokens(tokensProtos)
      .build();
  // Send the RPC
  GetHdfsBlockLocationsResponseProto response;
  try {
    response = rpcProxy.getHdfsBlockLocations(NULL_CONTROLLER, request);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
  // List of volumes in the response
  List<ByteString> volumeIdsByteStrings = response.getVolumeIdsList();
  List<byte[]> volumeIds = new ArrayList<byte[]>(volumeIdsByteStrings.size());
  for (ByteString bs : volumeIdsByteStrings) {
    volumeIds.add(bs.toByteArray());
  }
  // Array of indexes into the list of volumes, one per block
  List<Integer> volumeIndexes = response.getVolumeIndexesList();
  // Parsed HdfsVolumeId values, one per block
  return new HdfsBlocksMetadata(blocks.toArray(new ExtendedBlock[] {}), 
      volumeIds, volumeIndexes);
}
项目:hadoop-TCP    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:hardfs    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
 return ExtendedBlockProto.newBuilder().
    setPoolId(b.getBlockPoolId()).
    setBlockId(b.getBlockId()).
    setNumBytes(b.getNumBytes()).
    setGenerationStamp(b.getGenerationStamp()).
    build();
}
项目:hardfs    文件:ClientDatanodeProtocolTranslatorPB.java   
@Override
public HdfsBlocksMetadata getHdfsBlocksMetadata(List<ExtendedBlock> blocks,
    List<Token<BlockTokenIdentifier>> tokens) throws IOException {
  // Convert to proto objects
  List<ExtendedBlockProto> blocksProtos = 
      new ArrayList<ExtendedBlockProto>(blocks.size());
  List<TokenProto> tokensProtos = 
      new ArrayList<TokenProto>(tokens.size());
  for (ExtendedBlock b : blocks) {
    blocksProtos.add(PBHelper.convert(b));
  }
  for (Token<BlockTokenIdentifier> t : tokens) {
    tokensProtos.add(PBHelper.convert(t));
  }
  // Build the request
  GetHdfsBlockLocationsRequestProto request = 
      GetHdfsBlockLocationsRequestProto.newBuilder()
      .addAllBlocks(blocksProtos)
      .addAllTokens(tokensProtos)
      .build();
  // Send the RPC
  GetHdfsBlockLocationsResponseProto response;
  try {
    response = rpcProxy.getHdfsBlockLocations(NULL_CONTROLLER, request);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
  // List of volumes in the response
  List<ByteString> volumeIdsByteStrings = response.getVolumeIdsList();
  List<byte[]> volumeIds = new ArrayList<byte[]>(volumeIdsByteStrings.size());
  for (ByteString bs : volumeIdsByteStrings) {
    volumeIds.add(bs.toByteArray());
  }
  // Array of indexes into the list of volumes, one per block
  List<Integer> volumeIndexes = response.getVolumeIndexesList();
  // Parsed HdfsVolumeId values, one per block
  return new HdfsBlocksMetadata(blocks.toArray(new ExtendedBlock[] {}), 
      volumeIds, volumeIndexes);
}
项目:hardfs    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:hadoop-on-lustre2    文件:PBHelper.java   
public static ExtendedBlockProto convert(final ExtendedBlock b) {
  if (b == null) return null;
 return ExtendedBlockProto.newBuilder().
    setPoolId(b.getBlockPoolId()).
    setBlockId(b.getBlockId()).
    setNumBytes(b.getNumBytes()).
    setGenerationStamp(b.getGenerationStamp()).
    build();
}
项目:hadoop-on-lustre2    文件:TestPBHelper.java   
@Test
public void testConvertExtendedBlock() {
  ExtendedBlock b = getExtendedBlock();
  ExtendedBlockProto bProto = PBHelper.convert(b);
  ExtendedBlock b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);

  b.setBlockId(-1);
  bProto = PBHelper.convert(b);
  b1 = PBHelper.convert(bProto);
  assertEquals(b, b1);
}
项目:hadoop    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(),  eb.getBlockId(),   eb.getNumBytes(),
     eb.getGenerationStamp());
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(), eb.getBlockId(), eb.getNumBytes(),
      eb.getGenerationStamp());
}
项目:big-c    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(),  eb.getBlockId(),   eb.getNumBytes(),
     eb.getGenerationStamp());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(),  eb.getBlockId(),   eb.getNumBytes(),
     eb.getGenerationStamp());
}
项目:hadoop-plus    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(),  eb.getBlockId(),   eb.getNumBytes(),
     eb.getGenerationStamp());
}
项目:FlexMap    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(),  eb.getBlockId(),   eb.getNumBytes(),
     eb.getGenerationStamp());
}
项目:hadoop-TCP    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(),  eb.getBlockId(),   eb.getNumBytes(),
     eb.getGenerationStamp());
}
项目:hardfs    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(),  eb.getBlockId(),   eb.getNumBytes(),
     eb.getGenerationStamp());
}
项目:hadoop-on-lustre2    文件:PBHelper.java   
public static ExtendedBlock convert(ExtendedBlockProto eb) {
  if (eb == null) return null;
  return new ExtendedBlock( eb.getPoolId(),  eb.getBlockId(),   eb.getNumBytes(),
     eb.getGenerationStamp());
}
项目:hbase    文件:FanOutOneBlockAsyncDFSOutputHelper.java   
ExtendedBlockProto convert(ExtendedBlock b);