Search in sources :

Example 1 with StorageTypeProto

use of org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageTypeProto in project ozone by apache.

the class HddsTestUtils method createMetadataStorageReport.

/**
 * Creates metadata storage report with the given information.
 *
 * @param path      storage dir
 * @param capacity  storage size
 * @param used      space used
 * @param remaining space remaining
 * @param type      type of storage
 *
 * @return StorageReportProto
 */
public static MetadataStorageReportProto createMetadataStorageReport(String path, long capacity, long used, long remaining, StorageTypeProto type, boolean failed) {
    Preconditions.checkNotNull(path);
    MetadataStorageReportProto.Builder srb = MetadataStorageReportProto.newBuilder();
    srb.setStorageLocation(path).setCapacity(capacity).setScmUsed(used).setFailed(failed).setRemaining(remaining);
    StorageTypeProto storageTypeProto = type == null ? StorageTypeProto.DISK : type;
    srb.setStorageType(storageTypeProto);
    return srb.build();
}
Also used : StorageTypeProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageTypeProto) MetadataStorageReportProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.MetadataStorageReportProto)

Example 2 with StorageTypeProto

use of org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageTypeProto in project ozone by apache.

the class HddsTestUtils method createStorageReport.

/**
 * Creates storage report with the given information.
 *
 * @param nodeId    datanode id
 * @param path      storage dir
 * @param capacity  storage size
 * @param used      space used
 * @param remaining space remaining
 * @param type      type of storage
 *
 * @return StorageReportProto
 */
public static StorageReportProto createStorageReport(UUID nodeId, String path, long capacity, long used, long remaining, StorageTypeProto type, boolean failed) {
    Preconditions.checkNotNull(nodeId);
    Preconditions.checkNotNull(path);
    StorageReportProto.Builder srb = StorageReportProto.newBuilder();
    srb.setStorageUuid(nodeId.toString()).setStorageLocation(path).setCapacity(capacity).setScmUsed(used).setFailed(failed).setRemaining(remaining);
    StorageTypeProto storageTypeProto = type == null ? StorageTypeProto.DISK : type;
    srb.setStorageType(storageTypeProto);
    return srb.build();
}
Also used : StorageTypeProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageTypeProto) MetadataStorageReportProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.MetadataStorageReportProto) StorageReportProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageReportProto)

Aggregations

MetadataStorageReportProto (org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.MetadataStorageReportProto)2 StorageTypeProto (org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageTypeProto)2 StorageReportProto (org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageReportProto)1