From 837f2f77fed3ec22cbea5df92f40b6aafcf950ac Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Thu, 6 Oct 2022 13:51:02 -0400 Subject: [PATCH 1/3] feat: add apis for Mutation and RowMutationEntry --- .../cloud/bigtable/data/v2/models/Mutation.java | 14 ++++++++++++++ .../bigtable/data/v2/models/RowMutationEntry.java | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java index 326d78cfe0..191e7edc8d 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java @@ -30,6 +30,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; +import java.util.Iterator; import java.util.List; import javax.annotation.Nonnull; @@ -87,6 +88,19 @@ public static Mutation fromProtoUnsafe(List pro return mutation; } + /** + * Wraps the List of protobuf {@link com.google.bigtable.v2.Mutation}. This methods, like {@link + * #createUnsafe()}, allows setCell operation to use server side timestamp. This is dangerous + * because mutations will no longer be idempotent, which might cause multiple duplicate values to + * be stored in Bigtable. This option should only be used for advanced usecases with extreme care. + */ + @BetaApi + public static Mutation fromProtoUnsafe(Iterator protos) { + Mutation mutation = new Mutation(true); + mutation.mutations.addAll(protos); + return mutation; + } + /** * Constructs a row mutation from an existing protobuf object. * diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java index 9239b30497..63ffe708a5 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java @@ -15,6 +15,7 @@ */ package com.google.cloud.bigtable.data.v2.models; +import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.bigtable.v2.MutateRowsRequest; import com.google.common.base.Preconditions; @@ -54,6 +55,13 @@ public static RowMutationEntry create(@Nonnull ByteString key) { return new RowMutationEntry(key, Mutation.create()); } + /** Creates a new instance from existing mutation. */ + @BetaApi + public static RowMutationEntry createFromMutationUnsafe( + @Nonnull ByteString key, @Nonnull Mutation mutation) { + return new RowMutationEntry(key, mutation); + } + /** * Creates new instance of mutation builder which allows server timestamp for setCell operations. * From 3f798a9923828b256707bd78e87ef7a696278e65 Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Thu, 6 Oct 2022 20:41:18 -0400 Subject: [PATCH 2/3] use iterable instead of iterator --- .../com/google/cloud/bigtable/data/v2/models/Mutation.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java index 191e7edc8d..6c1402685d 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java @@ -30,7 +30,6 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import java.util.Iterator; import java.util.List; import javax.annotation.Nonnull; @@ -95,7 +94,7 @@ public static Mutation fromProtoUnsafe(List pro * be stored in Bigtable. This option should only be used for advanced usecases with extreme care. */ @BetaApi - public static Mutation fromProtoUnsafe(Iterator protos) { + public static Mutation fromProtoUnsafe(Iterable protos) { Mutation mutation = new Mutation(true); mutation.mutations.addAll(protos); return mutation; From 07176907d59d130875342139824b1fa896292d32 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 11 Oct 2022 19:27:01 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 81f5316785..a161d69d81 100644 --- a/README.md +++ b/README.md @@ -49,20 +49,20 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.1.2') +implementation platform('com.google.cloud:libraries-bom:26.1.3') implementation 'com.google.cloud:google-cloud-bigtable' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigtable:2.12.0' +implementation 'com.google.cloud:google-cloud-bigtable:2.14.1' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.12.0" +libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.14.1" ``` ## Authentication