a-li commented on code in PR #449:
URL: https://github.com/apache/incubator-uniffle/pull/449#discussion_r1058114284
##########
common/src/main/java/org/apache/uniffle/common/storage/LocalStorageInfoUtils.java:
##########
@@ -0,0 +1,30 @@
+package org.apache.uniffle.common.storage;
+
+import com.google.common.collect.Maps;
+import org.apache.uniffle.proto.RssProtos;
+
+import java.util.Map;
+
+public class LocalStorageInfoUtils {
+ public static Map<String, RssProtos.LocalStorageInfo> toProto(
+ Map<String, LocalStorageInfo> info) {
+ Map<String, RssProtos.LocalStorageInfo> result =
Maps.newHashMapWithExpectedSize(info.size());
+ info.forEach((k, v) -> result.put(k, v.toProto()));
+ return result;
+ }
+
+ public static Map<String, LocalStorageInfo> fromProto(Map<String,
RssProtos.LocalStorageInfo> info) {
+ Map<String, LocalStorageInfo> result =
Maps.newHashMapWithExpectedSize(info.size());
+ for (Map.Entry<String, RssProtos.LocalStorageInfo> entry :
info.entrySet()) {
+ String key = entry.getKey();
+ RssProtos.LocalStorageInfo val = entry.getValue();
+ LocalStorageInfo localStorageInfo = new LocalStorageInfo(
+ val.getMountPoint(),
+ LocalStorageType.fromProto(val.getStorageType()),
+ val.getCapacity(),
+ val.getUsedBytes(),
+ LocalStorageStatus.fromProto(val.getStatus()));
+ }
Review Comment:
Is it missing a `result.put` call here inside the for loop?
--
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]