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

项目:hadoop    文件:PBHelper.java   
public static BlockStoragePolicyProto convert(BlockStoragePolicy policy) {
  BlockStoragePolicyProto.Builder builder = BlockStoragePolicyProto
      .newBuilder().setPolicyId(policy.getId()).setName(policy.getName());
  // creation storage types
  StorageTypesProto creationProto = convert(policy.getStorageTypes());
  Preconditions.checkArgument(creationProto != null);
  builder.setCreationPolicy(creationProto);
  // creation fallback
  StorageTypesProto creationFallbackProto = convert(
      policy.getCreationFallbacks());
  if (creationFallbackProto != null) {
    builder.setCreationFallbackPolicy(creationFallbackProto);
  }
  // replication fallback
  StorageTypesProto replicationFallbackProto = convert(
      policy.getReplicationFallbacks());
  if (replicationFallbackProto != null) {
    builder.setReplicationFallbackPolicy(replicationFallbackProto);
  }
  return builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static BlockStoragePolicyProto convert(BlockStoragePolicy policy) {
  BlockStoragePolicyProto.Builder builder = BlockStoragePolicyProto
      .newBuilder().setPolicyId(policy.getId()).setName(policy.getName());
  // creation storage types
  StorageTypesProto creationProto = convert(policy.getStorageTypes());
  Preconditions.checkArgument(creationProto != null);
  builder.setCreationPolicy(creationProto);
  // creation fallback
  StorageTypesProto creationFallbackProto = convert(
      policy.getCreationFallbacks());
  if (creationFallbackProto != null) {
    builder.setCreationFallbackPolicy(creationFallbackProto);
  }
  // replication fallback
  StorageTypesProto replicationFallbackProto = convert(
      policy.getReplicationFallbacks());
  if (replicationFallbackProto != null) {
    builder.setReplicationFallbackPolicy(replicationFallbackProto);
  }
  return builder.build();
}
项目:big-c    文件:PBHelper.java   
public static BlockStoragePolicyProto convert(BlockStoragePolicy policy) {
  BlockStoragePolicyProto.Builder builder = BlockStoragePolicyProto
      .newBuilder().setPolicyId(policy.getId()).setName(policy.getName());
  // creation storage types
  StorageTypesProto creationProto = convert(policy.getStorageTypes());
  Preconditions.checkArgument(creationProto != null);
  builder.setCreationPolicy(creationProto);
  // creation fallback
  StorageTypesProto creationFallbackProto = convert(
      policy.getCreationFallbacks());
  if (creationFallbackProto != null) {
    builder.setCreationFallbackPolicy(creationFallbackProto);
  }
  // replication fallback
  StorageTypesProto replicationFallbackProto = convert(
      policy.getReplicationFallbacks());
  if (replicationFallbackProto != null) {
    builder.setReplicationFallbackPolicy(replicationFallbackProto);
  }
  return builder.build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static BlockStoragePolicyProto convert(BlockStoragePolicy policy) {
  BlockStoragePolicyProto.Builder builder = BlockStoragePolicyProto
      .newBuilder().setPolicyId(policy.getId()).setName(policy.getName());
  // creation storage types
  StorageTypesProto creationProto = convert(policy.getStorageTypes());
  Preconditions.checkArgument(creationProto != null);
  builder.setCreationPolicy(creationProto);
  // creation fallback
  StorageTypesProto creationFallbackProto = convert(
      policy.getCreationFallbacks());
  if (creationFallbackProto != null) {
    builder.setCreationFallbackPolicy(creationFallbackProto);
  }
  // replication fallback
  StorageTypesProto replicationFallbackProto = convert(
      policy.getReplicationFallbacks());
  if (replicationFallbackProto != null) {
    builder.setReplicationFallbackPolicy(replicationFallbackProto);
  }
  return builder.build();
}
项目:FlexMap    文件:PBHelper.java   
public static BlockStoragePolicyProto convert(BlockStoragePolicy policy) {
  BlockStoragePolicyProto.Builder builder = BlockStoragePolicyProto
      .newBuilder().setPolicyId(policy.getId()).setName(policy.getName());
  // creation storage types
  StorageTypesProto creationProto = convert(policy.getStorageTypes());
  Preconditions.checkArgument(creationProto != null);
  builder.setCreationPolicy(creationProto);
  // creation fallback
  StorageTypesProto creationFallbackProto = convert(
      policy.getCreationFallbacks());
  if (creationFallbackProto != null) {
    builder.setCreationFallbackPolicy(creationFallbackProto);
  }
  // replication fallback
  StorageTypesProto replicationFallbackProto = convert(
      policy.getReplicationFallbacks());
  if (replicationFallbackProto != null) {
    builder.setReplicationFallbackPolicy(replicationFallbackProto);
  }
  return builder.build();
}
项目:hadoop    文件:PBHelper.java   
public static StorageTypesProto convert(StorageType[] types) {
  if (types == null || types.length == 0) {
    return null;
  }
  List<StorageTypeProto> list = convertStorageTypes(types);
  return StorageTypesProto.newBuilder().addAllStorageTypes(list).build();
}
项目:hadoop    文件:PBHelper.java   
private static List<StorageTypesProto> convert(StorageType[][] types) {
  List<StorageTypesProto> list = Lists.newArrayList();
  if (types != null) {
    for (StorageType[] ts : types) {
      StorageTypesProto.Builder builder = StorageTypesProto.newBuilder();
      builder.addAllStorageTypes(convertStorageTypes(ts));
      list.add(builder.build());
    }
  }
  return list;
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
static List<StorageTypesProto> convert(StorageType[][] types) {
  List<StorageTypesProto> list = Lists.newArrayList();
  if (types != null) {
    for (StorageType[] ts : types) {
      StorageTypesProto.Builder builder = StorageTypesProto.newBuilder();
      builder.addAllStorageTypes(convertStorageTypes(ts));
      list.add(builder.build());
    }
  }
  return list;
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static StorageTypesProto convert(StorageType[] types) {
  if (types == null || types.length == 0) {
    return null;
  }
  List<StorageTypeProto> list = convertStorageTypes(types);
  return StorageTypesProto.newBuilder().addAllStorageTypes(list).build();
}
项目:aliyun-oss-hadoop-fs    文件:PBHelper.java   
private static StorageTypesProto convertStorageTypesProto(
    StorageType[] targetStorageTypes) {
  StorageTypesProto.Builder builder = StorageTypesProto.newBuilder();
  for (StorageType storageType : targetStorageTypes) {
    builder.addStorageTypes(PBHelperClient.convertStorageType(storageType));
  }
  return builder.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);
}
项目:big-c    文件:PBHelper.java   
public static StorageTypesProto convert(StorageType[] types) {
  if (types == null || types.length == 0) {
    return null;
  }
  List<StorageTypeProto> list = convertStorageTypes(types);
  return StorageTypesProto.newBuilder().addAllStorageTypes(list).build();
}
项目:big-c    文件:PBHelper.java   
private static List<StorageTypesProto> convert(StorageType[][] types) {
  List<StorageTypesProto> list = Lists.newArrayList();
  if (types != null) {
    for (StorageType[] ts : types) {
      StorageTypesProto.Builder builder = StorageTypesProto.newBuilder();
      builder.addAllStorageTypes(convertStorageTypes(ts));
      list.add(builder.build());
    }
  }
  return list;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static StorageTypesProto convert(StorageType[] types) {
  if (types == null || types.length == 0) {
    return null;
  }
  List<StorageTypeProto> list = convertStorageTypes(types);
  return StorageTypesProto.newBuilder().addAllStorageTypes(list).build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
private static List<StorageTypesProto> convert(StorageType[][] types) {
  List<StorageTypesProto> list = Lists.newArrayList();
  if (types != null) {
    for (StorageType[] ts : types) {
      StorageTypesProto.Builder builder = StorageTypesProto.newBuilder();
      builder.addAllStorageTypes(convertStorageTypes(ts));
      list.add(builder.build());
    }
  }
  return list;
}
项目:FlexMap    文件:PBHelper.java   
public static StorageTypesProto convert(StorageType[] types) {
  if (types == null || types.length == 0) {
    return null;
  }
  List<StorageTypeProto> list = convertStorageTypes(types);
  return StorageTypesProto.newBuilder().addAllStorageTypes(list).build();
}
项目:FlexMap    文件:PBHelper.java   
private static List<StorageTypesProto> convert(StorageType[][] types) {
  List<StorageTypesProto> list = Lists.newArrayList();
  if (types != null) {
    for (StorageType[] ts : types) {
      StorageTypesProto.Builder builder = StorageTypesProto.newBuilder();
      builder.addAllStorageTypes(convertStorageTypes(ts));
      list.add(builder.build());
    }
  }
  return list;
}
项目:hadoop    文件:PBHelper.java   
public static BlockCommand convert(BlockCommandProto blkCmd) {
  List<BlockProto> blockProtoList = blkCmd.getBlocksList();
  Block[] blocks = new Block[blockProtoList.size()];
  for (int i = 0; i < blockProtoList.size(); i++) {
    blocks[i] = PBHelper.convert(blockProtoList.get(i));
  }
  List<DatanodeInfosProto> targetList = blkCmd.getTargetsList();
  DatanodeInfo[][] targets = new DatanodeInfo[targetList.size()][];
  for (int i = 0; i < targetList.size(); i++) {
    targets[i] = PBHelper.convert(targetList.get(i));
  }

  StorageType[][] targetStorageTypes = new StorageType[targetList.size()][];
  List<StorageTypesProto> targetStorageTypesList = blkCmd.getTargetStorageTypesList();
  if (targetStorageTypesList.isEmpty()) { // missing storage types
    for(int i = 0; i < targetStorageTypes.length; i++) {
      targetStorageTypes[i] = new StorageType[targets[i].length];
      Arrays.fill(targetStorageTypes[i], StorageType.DEFAULT);
    }
  } else {
    for(int i = 0; i < targetStorageTypes.length; i++) {
      List<StorageTypeProto> p = targetStorageTypesList.get(i).getStorageTypesList();
      targetStorageTypes[i] = convertStorageTypes(p, targets[i].length);
    }
  }

  List<StorageUuidsProto> targetStorageUuidsList = blkCmd.getTargetStorageUuidsList();
  String[][] targetStorageIDs = new String[targetStorageUuidsList.size()][];
  for(int i = 0; i < targetStorageIDs.length; i++) {
    List<String> storageIDs = targetStorageUuidsList.get(i).getStorageUuidsList();
    targetStorageIDs[i] = storageIDs.toArray(new String[storageIDs.size()]);
  }

  int action = DatanodeProtocol.DNA_UNKNOWN;
  switch (blkCmd.getAction()) {
  case TRANSFER:
    action = DatanodeProtocol.DNA_TRANSFER;
    break;
  case INVALIDATE:
    action = DatanodeProtocol.DNA_INVALIDATE;
    break;
  case SHUTDOWN:
    action = DatanodeProtocol.DNA_SHUTDOWN;
    break;
  default:
    throw new AssertionError("Unknown action type: " + blkCmd.getAction());
  }
  return new BlockCommand(action, blkCmd.getBlockPoolId(), blocks, targets,
      targetStorageTypes, targetStorageIDs);
}
项目:aliyun-oss-hadoop-fs    文件:PBHelper.java   
public static BlockCommand convert(BlockCommandProto blkCmd) {
  List<BlockProto> blockProtoList = blkCmd.getBlocksList();
  Block[] blocks = new Block[blockProtoList.size()];
  for (int i = 0; i < blockProtoList.size(); i++) {
    blocks[i] = PBHelperClient.convert(blockProtoList.get(i));
  }
  List<DatanodeInfosProto> targetList = blkCmd.getTargetsList();
  DatanodeInfo[][] targets = new DatanodeInfo[targetList.size()][];
  for (int i = 0; i < targetList.size(); i++) {
    targets[i] = PBHelperClient.convert(targetList.get(i));
  }

  StorageType[][] targetStorageTypes = new StorageType[targetList.size()][];
  List<StorageTypesProto> targetStorageTypesList = blkCmd.getTargetStorageTypesList();
  if (targetStorageTypesList.isEmpty()) { // missing storage types
    for(int i = 0; i < targetStorageTypes.length; i++) {
      targetStorageTypes[i] = new StorageType[targets[i].length];
      Arrays.fill(targetStorageTypes[i], StorageType.DEFAULT);
    }
  } else {
    for(int i = 0; i < targetStorageTypes.length; i++) {
      List<StorageTypeProto> p = targetStorageTypesList.get(i).getStorageTypesList();
      targetStorageTypes[i] = PBHelperClient.convertStorageTypes(p, targets[i].length);
    }
  }

  List<StorageUuidsProto> targetStorageUuidsList = blkCmd.getTargetStorageUuidsList();
  String[][] targetStorageIDs = new String[targetStorageUuidsList.size()][];
  for(int i = 0; i < targetStorageIDs.length; i++) {
    List<String> storageIDs = targetStorageUuidsList.get(i).getStorageUuidsList();
    targetStorageIDs[i] = storageIDs.toArray(new String[storageIDs.size()]);
  }

  int action = DatanodeProtocol.DNA_UNKNOWN;
  switch (blkCmd.getAction()) {
  case TRANSFER:
    action = DatanodeProtocol.DNA_TRANSFER;
    break;
  case INVALIDATE:
    action = DatanodeProtocol.DNA_INVALIDATE;
    break;
  case SHUTDOWN:
    action = DatanodeProtocol.DNA_SHUTDOWN;
    break;
  default:
    throw new AssertionError("Unknown action type: " + blkCmd.getAction());
  }
  return new BlockCommand(action, blkCmd.getBlockPoolId(), blocks, targets,
      targetStorageTypes, targetStorageIDs);
}
项目:big-c    文件:PBHelper.java   
public static BlockCommand convert(BlockCommandProto blkCmd) {
  List<BlockProto> blockProtoList = blkCmd.getBlocksList();
  Block[] blocks = new Block[blockProtoList.size()];
  for (int i = 0; i < blockProtoList.size(); i++) {
    blocks[i] = PBHelper.convert(blockProtoList.get(i));
  }
  List<DatanodeInfosProto> targetList = blkCmd.getTargetsList();
  DatanodeInfo[][] targets = new DatanodeInfo[targetList.size()][];
  for (int i = 0; i < targetList.size(); i++) {
    targets[i] = PBHelper.convert(targetList.get(i));
  }

  StorageType[][] targetStorageTypes = new StorageType[targetList.size()][];
  List<StorageTypesProto> targetStorageTypesList = blkCmd.getTargetStorageTypesList();
  if (targetStorageTypesList.isEmpty()) { // missing storage types
    for(int i = 0; i < targetStorageTypes.length; i++) {
      targetStorageTypes[i] = new StorageType[targets[i].length];
      Arrays.fill(targetStorageTypes[i], StorageType.DEFAULT);
    }
  } else {
    for(int i = 0; i < targetStorageTypes.length; i++) {
      List<StorageTypeProto> p = targetStorageTypesList.get(i).getStorageTypesList();
      targetStorageTypes[i] = convertStorageTypes(p, targets[i].length);
    }
  }

  List<StorageUuidsProto> targetStorageUuidsList = blkCmd.getTargetStorageUuidsList();
  String[][] targetStorageIDs = new String[targetStorageUuidsList.size()][];
  for(int i = 0; i < targetStorageIDs.length; i++) {
    List<String> storageIDs = targetStorageUuidsList.get(i).getStorageUuidsList();
    targetStorageIDs[i] = storageIDs.toArray(new String[storageIDs.size()]);
  }

  int action = DatanodeProtocol.DNA_UNKNOWN;
  switch (blkCmd.getAction()) {
  case TRANSFER:
    action = DatanodeProtocol.DNA_TRANSFER;
    break;
  case INVALIDATE:
    action = DatanodeProtocol.DNA_INVALIDATE;
    break;
  case SHUTDOWN:
    action = DatanodeProtocol.DNA_SHUTDOWN;
    break;
  default:
    throw new AssertionError("Unknown action type: " + blkCmd.getAction());
  }
  return new BlockCommand(action, blkCmd.getBlockPoolId(), blocks, targets,
      targetStorageTypes, targetStorageIDs);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static BlockCommand convert(BlockCommandProto blkCmd) {
  List<BlockProto> blockProtoList = blkCmd.getBlocksList();
  Block[] blocks = new Block[blockProtoList.size()];
  for (int i = 0; i < blockProtoList.size(); i++) {
    blocks[i] = PBHelper.convert(blockProtoList.get(i));
  }
  List<DatanodeInfosProto> targetList = blkCmd.getTargetsList();
  DatanodeInfo[][] targets = new DatanodeInfo[targetList.size()][];
  for (int i = 0; i < targetList.size(); i++) {
    targets[i] = PBHelper.convert(targetList.get(i));
  }

  StorageType[][] targetStorageTypes = new StorageType[targetList.size()][];
  List<StorageTypesProto> targetStorageTypesList = blkCmd.getTargetStorageTypesList();
  if (targetStorageTypesList.isEmpty()) { // missing storage types
    for(int i = 0; i < targetStorageTypes.length; i++) {
      targetStorageTypes[i] = new StorageType[targets[i].length];
      Arrays.fill(targetStorageTypes[i], StorageType.DEFAULT);
    }
  } else {
    for(int i = 0; i < targetStorageTypes.length; i++) {
      List<StorageTypeProto> p = targetStorageTypesList.get(i).getStorageTypesList();
      targetStorageTypes[i] = convertStorageTypes(p, targets[i].length);
    }
  }

  List<StorageUuidsProto> targetStorageUuidsList = blkCmd.getTargetStorageUuidsList();
  String[][] targetStorageIDs = new String[targetStorageUuidsList.size()][];
  for(int i = 0; i < targetStorageIDs.length; i++) {
    List<String> storageIDs = targetStorageUuidsList.get(i).getStorageUuidsList();
    targetStorageIDs[i] = storageIDs.toArray(new String[storageIDs.size()]);
  }

  int action = DatanodeProtocol.DNA_UNKNOWN;
  switch (blkCmd.getAction()) {
  case TRANSFER:
    action = DatanodeProtocol.DNA_TRANSFER;
    break;
  case INVALIDATE:
    action = DatanodeProtocol.DNA_INVALIDATE;
    break;
  case SHUTDOWN:
    action = DatanodeProtocol.DNA_SHUTDOWN;
    break;
  default:
    throw new AssertionError("Unknown action type: " + blkCmd.getAction());
  }
  return new BlockCommand(action, blkCmd.getBlockPoolId(), blocks, targets,
      targetStorageTypes, targetStorageIDs);
}
项目:FlexMap    文件:PBHelper.java   
public static BlockCommand convert(BlockCommandProto blkCmd) {
  List<BlockProto> blockProtoList = blkCmd.getBlocksList();
  Block[] blocks = new Block[blockProtoList.size()];
  for (int i = 0; i < blockProtoList.size(); i++) {
    blocks[i] = PBHelper.convert(blockProtoList.get(i));
  }
  List<DatanodeInfosProto> targetList = blkCmd.getTargetsList();
  DatanodeInfo[][] targets = new DatanodeInfo[targetList.size()][];
  for (int i = 0; i < targetList.size(); i++) {
    targets[i] = PBHelper.convert(targetList.get(i));
  }

  StorageType[][] targetStorageTypes = new StorageType[targetList.size()][];
  List<StorageTypesProto> targetStorageTypesList = blkCmd.getTargetStorageTypesList();
  if (targetStorageTypesList.isEmpty()) { // missing storage types
    for(int i = 0; i < targetStorageTypes.length; i++) {
      targetStorageTypes[i] = new StorageType[targets[i].length];
      Arrays.fill(targetStorageTypes[i], StorageType.DEFAULT);
    }
  } else {
    for(int i = 0; i < targetStorageTypes.length; i++) {
      List<StorageTypeProto> p = targetStorageTypesList.get(i).getStorageTypesList();
      targetStorageTypes[i] = convertStorageTypes(p, targets[i].length);
    }
  }

  List<StorageUuidsProto> targetStorageUuidsList = blkCmd.getTargetStorageUuidsList();
  String[][] targetStorageIDs = new String[targetStorageUuidsList.size()][];
  for(int i = 0; i < targetStorageIDs.length; i++) {
    List<String> storageIDs = targetStorageUuidsList.get(i).getStorageUuidsList();
    targetStorageIDs[i] = storageIDs.toArray(new String[storageIDs.size()]);
  }

  int action = DatanodeProtocol.DNA_UNKNOWN;
  switch (blkCmd.getAction()) {
  case TRANSFER:
    action = DatanodeProtocol.DNA_TRANSFER;
    break;
  case INVALIDATE:
    action = DatanodeProtocol.DNA_INVALIDATE;
    break;
  case SHUTDOWN:
    action = DatanodeProtocol.DNA_SHUTDOWN;
    break;
  default:
    throw new AssertionError("Unknown action type: " + blkCmd.getAction());
  }
  return new BlockCommand(action, blkCmd.getBlockPoolId(), blocks, targets,
      targetStorageTypes, targetStorageIDs);
}