BenWhitehead commented on a change in pull request #14261:
URL: https://github.com/apache/beam/pull/14261#discussion_r605240897



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreDoFn.java
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.sdk.io.gcp.firestore;
+
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.display.DisplayData;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+
+/**
+ * Base class for all {@link DoFn} defined in the Firestore Connector.

Review comment:
       It is true for all of the `DoFn` which are stateful and have a lifecycle 
that must be managed. For the `DoFn` which perform RPCs, Setup is for the 
RpcQos management which we want to live longer than an individual bundle, and 
StartBundle is where we create the RPC clients based on the `PipelineOptions` 
from `StartBundleContext#getPipelineOptions()`.
   
   This base class also serves as an upper bound for the unit tests where all 
DoFn are checked to ensure they are serializable as well as performing some 
common mocking which is used across the majority of tests (e.g. 
`StartBundleContext`, `ProcessContext`, `Credentials` etc).
   
   There are a few `DoFn` which will be added in the "Read" PR to follow which 
directly extend DoFn and only implement a `@ProcessElement` method as they are 
otherwise stateless.
   
   I'll update the comment on this class to call out that it is specifically 
for Stateful `DoFn`.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to