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



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreV1.java
##########
@@ -0,0 +1,620 @@
+/*
+ * 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 static java.util.Objects.requireNonNull;
+
+import com.google.firestore.v1.BatchWriteRequest;
+import com.google.firestore.v1.WriteResult;
+import com.google.rpc.Status;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Objects;
+import javax.annotation.concurrent.Immutable;
+import 
org.apache.beam.sdk.io.gcp.firestore.FirestoreV1WriteFn.BatchWriteFnWithDeadLetterQueue;
+import 
org.apache.beam.sdk.io.gcp.firestore.FirestoreV1WriteFn.DefaultBatchWriteFn;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.Reshuffle;
+import org.apache.beam.sdk.transforms.display.DisplayData;
+import org.apache.beam.sdk.transforms.display.HasDisplayData;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PDone;
+import org.apache.beam.sdk.values.PInput;
+import org.apache.beam.sdk.values.POutput;
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+/**
+ * {@link FirestoreV1} provides an API which provides lifecycle managed {@link 
PTransform}s for
+ * <a target="_blank" rel="noopener noreferrer" 
href="https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1";>Cloud
+ * Firestore v1 API</a>.
+ * <p/>
+ * This class is part of the Firestore Connector DSL and should be accessed 
via {@link
+ * FirestoreIO#v1()}.
+ * <p/>
+ * All {@link PTransform}s provided by this API use {@link 
org.apache.beam.sdk.extensions.gcp.options.GcpOptions
+ * GcpOptions} on {@link org.apache.beam.sdk.options.PipelineOptions 
PipelineOptions} for
+ * credentials access and projectId resolution. As such, the lifecycle of gRPC 
clients and project
+ * information is scoped to the bundle level, not the worker level.
+ * <p/>
+ *
+ * <h3>Operations</h3>
+ * <h4>Write</h4>
+ * To write a {@link PCollection} to Cloud Firestore use {@link 
FirestoreV1#write()}, picking the
+ * behavior of the writer.
+ *
+ * Writes use Cloud Firestore's BatchWrite api which provides fine grained 
write semantics.
+ *
+ * The default behavior is to fail a bundle if any single write fails with a 
non-retryable error.
+ * <pre>{@code
+ * PCollection<Write> writes = ...;
+ * PDone sink = writes
+ *     .apply(FirestoreIO.v1().write().batchWrite().build());
+ * }</pre>
+ *
+ * Alternatively, if you'd rather output write failures to a Dead Letter Queue 
add
+ * {@link BatchWrite.Builder#withDeadLetterQueue() withDeadLetterQueue} when 
building your writer.
+ * <pre>{@code
+ * PCollection<Write> writes = ...;

Review comment:
       Note that there WriteResult is an output (not that we return a 
PCollection<WriteResult>).
   I'm not saying you should do that it was just an example.
   See here for a previous discussion on this and various options.
   
https://lists.apache.org/thread.html/d1a4556a1e13a661cce19021926a5d0997fbbfde016d36989cf75a07%40%3Cdev.beam.apache.org%3E




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