m-trieu commented on code in PR #27767:
URL: https://github.com/apache/beam/pull/27767#discussion_r1302326389


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/windmill/WindmillEndpoints.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.dataflow.worker.windmill;
+
+import static 
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList.toImmutableList;
+import static 
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap.toImmutableMap;
+
+import com.google.auto.value.AutoValue;
+import java.util.Map;
+import java.util.Optional;
+import 
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;
+import 
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap;
+
+/** Value class for holding endpoints used for communicating with Windmill 
service. */
+@AutoValue
+public abstract class WindmillEndpoints {
+  public static WindmillEndpoints from(
+      Windmill.WorkerMetadataResponse workerMetadataResponseProto) {
+    ImmutableMap<String, WindmillEndpoints.Endpoint> globalDataServers =
+        
workerMetadataResponseProto.getGlobalDataEndpointsMap().entrySet().stream()
+            .collect(
+                toImmutableMap(
+                    Map.Entry::getKey, // global data key
+                    endpoint -> 
WindmillEndpoints.Endpoint.from(endpoint.getValue())));
+
+    ImmutableList<WindmillEndpoints.Endpoint> windmillServers =
+        workerMetadataResponseProto.getDirectPathEndpointsList().stream()
+            .map(WindmillEndpoints.Endpoint::from)
+            .collect(toImmutableList());
+
+    return WindmillEndpoints.builder()
+        .setGlobalDataServers(globalDataServers)
+        .setWindmillServers(windmillServers)
+        .build();
+  }
+
+  public static WindmillEndpoints.Builder builder() {
+    return new AutoValue_WindmillEndpoints.Builder();
+  }
+
+  /**
+   * Used by GetData GlobalDataRequest(s) to support Beam side inputs. Returns 
a map where the key
+   * is a global data tag and the value is the endpoint where the data 
associated with the global
+   * data tag resides.
+   *
+   * @see <a 
href="https://beam.apache.org/documentation/programming-guide/#side-inputs";>Beam
 Side
+   *     Inputs</a>
+   */
+  public abstract ImmutableMap<String, Endpoint> globalDataServers();
+
+  /**
+   * Used by GetWork/GetData/CommitWork calls to send, receive, and commit 
work directly to/from
+   * Windmill servers. Returns a list of endpoints used to communicate with 
the corresponding
+   * Windmill servers.
+   */
+  public abstract ImmutableList<Endpoint> windmillServers();
+
+  @AutoValue

Review Comment:
   confirmed it does 
https://chromium.googlesource.com/external/github.com/google/auto/+/auto-value-1.0/value/README.md#background



-- 
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]

Reply via email to