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

项目: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 BlockStoragePolicy[] convertStoragePolicies(
    List<BlockStoragePolicyProto> policyProtos) {
  if (policyProtos == null || policyProtos.size() == 0) {
    return new BlockStoragePolicy[0];
  }
  BlockStoragePolicy[] policies = new BlockStoragePolicy[policyProtos.size()];
  int i = 0;
  for (BlockStoragePolicyProto proto : policyProtos) {
    policies[i++] = convert(proto);
  }
  return policies;
}
项目:hadoop    文件:PBHelper.java   
public static BlockStoragePolicy convert(BlockStoragePolicyProto proto) {
  List<StorageTypeProto> cList = proto.getCreationPolicy()
      .getStorageTypesList();
  StorageType[] creationTypes = convertStorageTypes(cList, cList.size());
  List<StorageTypeProto> cfList = proto.hasCreationFallbackPolicy() ? proto
      .getCreationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] creationFallbackTypes = cfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(cfList, cfList.size());
  List<StorageTypeProto> rfList = proto.hasReplicationFallbackPolicy() ?
      proto.getReplicationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] replicationFallbackTypes = rfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(rfList, rfList.size());
  return new BlockStoragePolicy((byte) proto.getPolicyId(), proto.getName(),
      creationTypes, creationFallbackTypes, replicationFallbackTypes);
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static BlockStoragePolicy[] convertStoragePolicies(
    List<BlockStoragePolicyProto> policyProtos) {
  if (policyProtos == null || policyProtos.size() == 0) {
    return new BlockStoragePolicy[0];
  }
  BlockStoragePolicy[] policies = new BlockStoragePolicy[policyProtos.size()];
  int i = 0;
  for (BlockStoragePolicyProto proto : policyProtos) {
    policies[i++] = convert(proto);
  }
  return policies;
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static BlockStoragePolicy convert(BlockStoragePolicyProto proto) {
  List<StorageTypeProto> cList = proto.getCreationPolicy()
      .getStorageTypesList();
  StorageType[] creationTypes = convertStorageTypes(cList, cList.size());
  List<StorageTypeProto> cfList = proto.hasCreationFallbackPolicy() ? proto
      .getCreationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] creationFallbackTypes = cfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(cfList, cfList.size());
  List<StorageTypeProto> rfList = proto.hasReplicationFallbackPolicy() ?
      proto.getReplicationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] replicationFallbackTypes = rfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(rfList, rfList.size());
  return new BlockStoragePolicy((byte) proto.getPolicyId(), proto.getName(),
      creationTypes, creationFallbackTypes, replicationFallbackTypes);
}
项目:aliyun-oss-hadoop-fs    文件:ClientNamenodeProtocolServerSideTranslatorPB.java   
@Override
public GetStoragePolicyResponseProto getStoragePolicy(
    RpcController controller, GetStoragePolicyRequestProto request)
    throws ServiceException {
  try {
    BlockStoragePolicyProto policy = PBHelperClient.convert(server
        .getStoragePolicy(request.getPath()));
    return GetStoragePolicyResponseProto.newBuilder()
        .setStoragePolicy(policy).build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:big-c    文件:PBHelper.java   
public static BlockStoragePolicy[] convertStoragePolicies(
    List<BlockStoragePolicyProto> policyProtos) {
  if (policyProtos == null || policyProtos.size() == 0) {
    return new BlockStoragePolicy[0];
  }
  BlockStoragePolicy[] policies = new BlockStoragePolicy[policyProtos.size()];
  int i = 0;
  for (BlockStoragePolicyProto proto : policyProtos) {
    policies[i++] = convert(proto);
  }
  return policies;
}
项目:big-c    文件:PBHelper.java   
public static BlockStoragePolicy convert(BlockStoragePolicyProto proto) {
  List<StorageTypeProto> cList = proto.getCreationPolicy()
      .getStorageTypesList();
  StorageType[] creationTypes = convertStorageTypes(cList, cList.size());
  List<StorageTypeProto> cfList = proto.hasCreationFallbackPolicy() ? proto
      .getCreationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] creationFallbackTypes = cfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(cfList, cfList.size());
  List<StorageTypeProto> rfList = proto.hasReplicationFallbackPolicy() ?
      proto.getReplicationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] replicationFallbackTypes = rfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(rfList, rfList.size());
  return new BlockStoragePolicy((byte) proto.getPolicyId(), proto.getName(),
      creationTypes, creationFallbackTypes, replicationFallbackTypes);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static BlockStoragePolicy[] convertStoragePolicies(
    List<BlockStoragePolicyProto> policyProtos) {
  if (policyProtos == null || policyProtos.size() == 0) {
    return new BlockStoragePolicy[0];
  }
  BlockStoragePolicy[] policies = new BlockStoragePolicy[policyProtos.size()];
  int i = 0;
  for (BlockStoragePolicyProto proto : policyProtos) {
    policies[i++] = convert(proto);
  }
  return policies;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static BlockStoragePolicy convert(BlockStoragePolicyProto proto) {
  List<StorageTypeProto> cList = proto.getCreationPolicy()
      .getStorageTypesList();
  StorageType[] creationTypes = convertStorageTypes(cList, cList.size());
  List<StorageTypeProto> cfList = proto.hasCreationFallbackPolicy() ? proto
      .getCreationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] creationFallbackTypes = cfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(cfList, cfList.size());
  List<StorageTypeProto> rfList = proto.hasReplicationFallbackPolicy() ?
      proto.getReplicationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] replicationFallbackTypes = rfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(rfList, rfList.size());
  return new BlockStoragePolicy((byte) proto.getPolicyId(), proto.getName(),
      creationTypes, creationFallbackTypes, replicationFallbackTypes);
}
项目:FlexMap    文件:PBHelper.java   
public static BlockStoragePolicy[] convertStoragePolicies(
    List<BlockStoragePolicyProto> policyProtos) {
  if (policyProtos == null || policyProtos.size() == 0) {
    return new BlockStoragePolicy[0];
  }
  BlockStoragePolicy[] policies = new BlockStoragePolicy[policyProtos.size()];
  int i = 0;
  for (BlockStoragePolicyProto proto : policyProtos) {
    policies[i++] = convert(proto);
  }
  return policies;
}
项目:FlexMap    文件:PBHelper.java   
public static BlockStoragePolicy convert(BlockStoragePolicyProto proto) {
  List<StorageTypeProto> cList = proto.getCreationPolicy()
      .getStorageTypesList();
  StorageType[] creationTypes = convertStorageTypes(cList, cList.size());
  List<StorageTypeProto> cfList = proto.hasCreationFallbackPolicy() ? proto
      .getCreationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] creationFallbackTypes = cfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(cfList, cfList.size());
  List<StorageTypeProto> rfList = proto.hasReplicationFallbackPolicy() ?
      proto.getReplicationFallbackPolicy().getStorageTypesList() : null;
  StorageType[] replicationFallbackTypes = rfList == null ? StorageType
      .EMPTY_ARRAY : convertStorageTypes(rfList, rfList.size());
  return new BlockStoragePolicy((byte) proto.getPolicyId(), proto.getName(),
      creationTypes, creationFallbackTypes, replicationFallbackTypes);
}