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 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..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 @@ -87,6 +87,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(Iterable 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. *