You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by GitBox <gi...@apache.org> on 2022/12/28 07:36:05 UTC

[GitHub] [incubator-uniffle] advancedxy commented on a diff in pull request #449: WIP: shuffle server report storage capability

advancedxy commented on code in PR #449:
URL: https://github.com/apache/incubator-uniffle/pull/449#discussion_r1058123170


##########
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:
   ah, thanks, forget to put into map.
   I will add more UTs in next commit. You can start reviewing when it's ready.



-- 
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: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org