Java Code Examples for org.apache.hadoop.fs.StorageType#EMPTY_ARRAY

The following examples show how to use org.apache.hadoop.fs.StorageType#EMPTY_ARRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PBHelper.java    From hadoop with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: PBHelper.java    From big-c with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: BlockStoragePolicySuite.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
public static BlockStoragePolicySuite createDefaultSuite() {
  final BlockStoragePolicy[] policies =
      new BlockStoragePolicy[1 << ID_BIT_LENGTH];
  final byte lazyPersistId = HdfsConstants.MEMORY_STORAGE_POLICY_ID;
  policies[lazyPersistId] = new BlockStoragePolicy(lazyPersistId, 
      HdfsConstants.MEMORY_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.RAM_DISK, StorageType.DISK},
      new StorageType[]{StorageType.DISK},
      new StorageType[]{StorageType.DISK},
      true);    // Cannot be changed on regular files, but inherited.
  final byte allssdId = HdfsConstants.ALLSSD_STORAGE_POLICY_ID;
  policies[allssdId] = new BlockStoragePolicy(allssdId,
      HdfsConstants.ALLSSD_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.SSD},
      new StorageType[]{StorageType.DISK},
      new StorageType[]{StorageType.DISK});
  final byte onessdId = HdfsConstants.ONESSD_STORAGE_POLICY_ID;
  policies[onessdId] = new BlockStoragePolicy(onessdId,
      HdfsConstants.ONESSD_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.SSD, StorageType.DISK},
      new StorageType[]{StorageType.SSD, StorageType.DISK},
      new StorageType[]{StorageType.SSD, StorageType.DISK});
  final byte hotId = HdfsConstants.HOT_STORAGE_POLICY_ID;
  policies[hotId] = new BlockStoragePolicy(hotId,
      HdfsConstants.HOT_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.DISK}, StorageType.EMPTY_ARRAY,
      new StorageType[]{StorageType.ARCHIVE});
  final byte warmId = HdfsConstants.WARM_STORAGE_POLICY_ID;
  policies[warmId] = new BlockStoragePolicy(warmId,
      HdfsConstants.WARM_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.DISK, StorageType.ARCHIVE},
      new StorageType[]{StorageType.DISK, StorageType.ARCHIVE},
      new StorageType[]{StorageType.DISK, StorageType.ARCHIVE});
  final byte coldId = HdfsConstants.COLD_STORAGE_POLICY_ID;
  policies[coldId] = new BlockStoragePolicy(coldId,
      HdfsConstants.COLD_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.ARCHIVE}, StorageType.EMPTY_ARRAY,
      StorageType.EMPTY_ARRAY);
  return new BlockStoragePolicySuite(hotId, policies);
}
 
Example 4
Source File: BlockStoragePolicySuite.java    From big-c with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
public static BlockStoragePolicySuite createDefaultSuite() {
  final BlockStoragePolicy[] policies =
      new BlockStoragePolicy[1 << ID_BIT_LENGTH];
  final byte lazyPersistId = HdfsConstants.MEMORY_STORAGE_POLICY_ID;
  policies[lazyPersistId] = new BlockStoragePolicy(lazyPersistId, 
      HdfsConstants.MEMORY_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.RAM_DISK, StorageType.DISK},
      new StorageType[]{StorageType.DISK},
      new StorageType[]{StorageType.DISK},
      true);    // Cannot be changed on regular files, but inherited.
  final byte allssdId = HdfsConstants.ALLSSD_STORAGE_POLICY_ID;
  policies[allssdId] = new BlockStoragePolicy(allssdId,
      HdfsConstants.ALLSSD_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.SSD},
      new StorageType[]{StorageType.DISK},
      new StorageType[]{StorageType.DISK});
  final byte onessdId = HdfsConstants.ONESSD_STORAGE_POLICY_ID;
  policies[onessdId] = new BlockStoragePolicy(onessdId,
      HdfsConstants.ONESSD_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.SSD, StorageType.DISK},
      new StorageType[]{StorageType.SSD, StorageType.DISK},
      new StorageType[]{StorageType.SSD, StorageType.DISK});
  final byte hotId = HdfsConstants.HOT_STORAGE_POLICY_ID;
  policies[hotId] = new BlockStoragePolicy(hotId,
      HdfsConstants.HOT_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.DISK}, StorageType.EMPTY_ARRAY,
      new StorageType[]{StorageType.ARCHIVE});
  final byte warmId = HdfsConstants.WARM_STORAGE_POLICY_ID;
  policies[warmId] = new BlockStoragePolicy(warmId,
      HdfsConstants.WARM_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.DISK, StorageType.ARCHIVE},
      new StorageType[]{StorageType.DISK, StorageType.ARCHIVE},
      new StorageType[]{StorageType.DISK, StorageType.ARCHIVE});
  final byte coldId = HdfsConstants.COLD_STORAGE_POLICY_ID;
  policies[coldId] = new BlockStoragePolicy(coldId,
      HdfsConstants.COLD_STORAGE_POLICY_NAME,
      new StorageType[]{StorageType.ARCHIVE}, StorageType.EMPTY_ARRAY,
      StorageType.EMPTY_ARRAY);
  return new BlockStoragePolicySuite(hotId, policies);
}