szetszwo commented on PR #8208: URL: https://github.com/apache/ozone/pull/8208#issuecomment-2770560264
Tried similar tests for `StorageContainerDatanodeProtocolProtos`. It is also wire and [protobuf text_format](https://googleapis.dev/python/protobuf/latest/google/protobuf/text_format.html) compatible. ```diff $diff HddsProtos2.txt StorageContainerDatanodeProtocolProtos.txt 1c1 < class org.apache.hadoop.hdds.protocol.proto.HddsProtos$StorageTypeProto --- > class org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos$StorageTypeProto ``` ```java public static void main(String[] args) { final StorageTypeProto[] values = { StorageTypeProto.DISK, StorageTypeProto.SSD, StorageTypeProto.ARCHIVE, StorageTypeProto.RAM_DISK }; System.out.println(StorageTypeProto.class); for (StorageTypeProto storageType : values) { final StorageReportProto info = StorageReportProto.newBuilder() .setStorageUuid("123") .setStorageLocation("datanode1") .setStorageType(storageType) .build(); System.out.println(); System.out.println(storageType + ":"); System.out.print(info); final byte[] bytes = info.toByteArray(); System.out.println("bytes: " + StringUtils.bytes2Hex(bytes) + ", length=" + bytes.length); } } ``` ``` class org.apache.hadoop.hdds.protocol.proto.HddsProtos$StorageTypeProto DISK: storageUuid: "123" storageLocation: "datanode1" storageType: DISK bytes: 0A 03 31 32 33 12 09 64 61 74 61 6E 6F 64 65 31 30 01 , length=18 SSD: storageUuid: "123" storageLocation: "datanode1" storageType: SSD bytes: 0A 03 31 32 33 12 09 64 61 74 61 6E 6F 64 65 31 30 02 , length=18 ARCHIVE: storageUuid: "123" storageLocation: "datanode1" storageType: ARCHIVE bytes: 0A 03 31 32 33 12 09 64 61 74 61 6E 6F 64 65 31 30 03 , length=18 RAM_DISK: storageUuid: "123" storageLocation: "datanode1" storageType: RAM_DISK bytes: 0A 03 31 32 33 12 09 64 61 74 61 6E 6F 64 65 31 30 04 , length=18 ``` ``` class org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos$StorageTypeProto DISK: storageUuid: "123" storageLocation: "datanode1" storageType: DISK bytes: 0A 03 31 32 33 12 09 64 61 74 61 6E 6F 64 65 31 30 01 , length=18 SSD: storageUuid: "123" storageLocation: "datanode1" storageType: SSD bytes: 0A 03 31 32 33 12 09 64 61 74 61 6E 6F 64 65 31 30 02 , length=18 ARCHIVE: storageUuid: "123" storageLocation: "datanode1" storageType: ARCHIVE bytes: 0A 03 31 32 33 12 09 64 61 74 61 6E 6F 64 65 31 30 03 , length=18 RAM_DISK: storageUuid: "123" storageLocation: "datanode1" storageType: RAM_DISK bytes: 0A 03 31 32 33 12 09 64 61 74 61 6E 6F 64 65 31 30 04 , length=18 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
